1#ifndef YAZE_UTIL_FILE_UTIL_H_
2#define YAZE_UTIL_FILE_UTIL_H_
50 std::function<
void(
const std::string&)> callback);
63 const std::string& default_name =
"",
64 const std::string& default_extension =
"");
70 const std::string& default_name =
"",
71 const std::string& default_extension =
"");
73 const std::string& default_name =
"",
74 const std::string& default_extension =
"");
78 const std::string& folder_path);
80 const std::string& folder_path);
111std::string
GetFileName(
const std::string& filename);
113void SaveFile(
const std::string& filename,
const std::string& data);
123std::string
LoadFile(
const std::string& filename);
static void ShowOpenFileDialogAsync(const FileDialogOptions &options, std::function< void(const std::string &)> callback)
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::optional< std::string > ConsumeSaveFileDialogResultForTesting()
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()
ScopedSaveFileDialogResultForTesting(const ScopedSaveFileDialogResultForTesting &)=delete
~ScopedSaveFileDialogResultForTesting()
ScopedSaveFileDialogResultForTesting(std::string result)
std::optional< std::string > result_
ScopedSaveFileDialogResultForTesting & operator=(const ScopedSaveFileDialogResultForTesting &)=delete
void SaveFile(const std::string &filename, const std::string &contents)
std::string GetFileName(const std::string &filename)
Gets the filename from a full path.
std::string GetResourcePath(const std::string &resource_path)
std::string LoadFileFromConfigDir(const std::string &filename)
Loads a file from the user's config directory.
FileDialogOptions MakeRomFileDialogOptions(bool include_all_files)
std::string GetFileExtension(const std::string &filename)
Gets the file extension from a filename.
std::string GetBundleResourcePath()
GetBundleResourcePath returns the path to the bundle resource directory. Specific to MacOS.
std::string LoadFile(const std::string &filename)
Loads the entire contents of a file into a string.
std::vector< FileDialogFilter > filters