15 nfdchar_t* outPath =
nullptr;
16 nfdfilteritem_t filterItem[2] = {{
"ROM Files",
"sfc,smc"},
18 nfdresult_t result = NFD_OpenDialog(&outPath, filterItem, 2,
nullptr);
20 if (result == NFD_OKAY) {
21 std::string path(outPath);
22 NFD_FreePath(outPath);
30 nfdchar_t* outPath =
nullptr;
31 nfdresult_t result = NFD_PickFolder(&outPath,
nullptr);
33 if (result == NFD_OKAY) {
34 std::string path(outPath);
35 NFD_FreePath(outPath);
43 const std::string& default_name,
const std::string& default_extension) {
44 nfdchar_t* outPath =
nullptr;
45 nfdfilteritem_t filterItem[1] = {
46 {default_extension.empty() ?
"All Files" : default_extension.c_str(),
47 default_extension.empty() ?
"*" : default_extension.c_str()}};
49 nfdresult_t result = NFD_SaveDialog(
50 &outPath, default_extension.empty() ?
nullptr : filterItem,
51 default_extension.empty() ? 0 : 1,
nullptr, default_name.c_str());
53 if (result == NFD_OKAY) {
54 std::string path(outPath);
55 NFD_FreePath(outPath);
63 const std::string& folder_path) {
64 std::vector<std::string> subdirs;
67 for (
const auto& entry : std::filesystem::directory_iterator(folder_path)) {
68 if (entry.is_directory()) {
69 subdirs.push_back(entry.path().string());
80 const std::string& folder_path) {
81 std::vector<std::string> files;
84 for (
const auto& entry : std::filesystem::directory_iterator(folder_path)) {
85 if (entry.is_regular_file()) {
86 files.push_back(entry.path().string());
106 const std::string& default_name,
const std::string& default_extension) {
111 const std::string& default_name,
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()