13 nfdchar_t* outPath =
nullptr;
14 nfdfilteritem_t filterItem[2] = {{
"ROM Files",
"sfc,smc"}, {
"All Files",
"*"}};
15 nfdresult_t result = NFD_OpenDialog(&outPath, filterItem, 2,
nullptr);
17 if (result == NFD_OKAY) {
18 std::string path(outPath);
19 NFD_FreePath(outPath);
27 nfdchar_t* outPath =
nullptr;
28 nfdresult_t result = NFD_PickFolder(&outPath,
nullptr);
30 if (result == NFD_OKAY) {
31 std::string path(outPath);
32 NFD_FreePath(outPath);
40 const std::string& default_extension) {
41 nfdchar_t* outPath =
nullptr;
42 nfdfilteritem_t filterItem[1] = {{default_extension.empty() ?
"All Files" : default_extension.c_str(),
43 default_extension.empty() ?
"*" : default_extension.c_str()}};
45 nfdresult_t result = NFD_SaveDialog(&outPath,
46 default_extension.empty() ?
nullptr : filterItem,
47 default_extension.empty() ? 0 : 1,
49 default_name.c_str());
51 if (result == NFD_OKAY) {
52 std::string path(outPath);
53 NFD_FreePath(outPath);
61 const std::string& folder_path) {
62 std::vector<std::string> subdirs;
65 for (
const auto& entry : std::filesystem::directory_iterator(folder_path)) {
66 if (entry.is_directory()) {
67 subdirs.push_back(entry.path().string());
78 const std::string& folder_path) {
79 std::vector<std::string> files;
82 for (
const auto& entry : std::filesystem::directory_iterator(folder_path)) {
83 if (entry.is_regular_file()) {
84 files.push_back(entry.path().string());
104 const std::string& default_extension) {
109 const std::string& default_extension) {
static std::string ShowSaveFileDialogBespoke(const std::string &default_name="", const std::string &default_extension="")
static std::string ShowOpenFileDialogBespoke()
static std::string ShowSaveFileDialogNFD(const std::string &default_name="", const std::string &default_extension="")
static std::string ShowOpenFolderDialogNFD()
static std::string ShowSaveFileDialog(const std::string &default_name="", const std::string &default_extension="")
ShowSaveFileDialog opens a save file dialog and returns the selected filepath. Uses global feature fl...
static std::string ShowOpenFileDialog()
ShowOpenFileDialog opens a file dialog and returns the selected filepath. Uses global feature flag to...
static std::string ShowOpenFolderDialog()
ShowOpenFolderDialog opens a file dialog and returns the selected folder path. Uses global feature fl...
static std::vector< std::string > GetFilesInFolder(const std::string &folder_path)
static std::vector< std::string > GetSubdirectoriesInFolder(const std::string &folder_path)
static std::string ShowOpenFolderDialogBespoke()
static std::string ShowOpenFileDialogNFD()
Main namespace for the application.