yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
file_util.h
Go to the documentation of this file.
1#ifndef YAZE_UTIL_FILE_UTIL_H_
2#define YAZE_UTIL_FILE_UTIL_H_
3
4#include <string>
5#include <vector>
6
7namespace yaze {
8namespace util {
9
11 public:
16 static std::string ShowOpenFileDialog();
17
22 static std::string ShowOpenFolderDialog();
23
28 static std::string ShowSaveFileDialog(const std::string& default_name = "",
29 const std::string& default_extension = "");
30
31 // Specific implementations for testing
32 static std::string ShowOpenFileDialogNFD();
33 static std::string ShowOpenFileDialogBespoke();
34 static std::string ShowSaveFileDialogNFD(const std::string& default_name = "",
35 const std::string& default_extension = "");
36 static std::string ShowSaveFileDialogBespoke(const std::string& default_name = "",
37 const std::string& default_extension = "");
38 static std::string ShowOpenFolderDialogNFD();
39 static std::string ShowOpenFolderDialogBespoke();
40 static std::vector<std::string> GetSubdirectoriesInFolder(
41 const std::string &folder_path);
42 static std::vector<std::string> GetFilesInFolder(
43 const std::string &folder_path);
44};
45
51
53
62std::string GetFileExtension(const std::string &filename);
63
72std::string GetFileName(const std::string &filename);
73std::string GetResourcePath(const std::string &resource_path);
74void SaveFile(const std::string &filename, const std::string &data);
75
84 std::string LoadFile(const std::string &filename);
85
92 std::string LoadFileFromConfigDir(const std::string &filename);
93
94} // namespace util
95} // namespace yaze
96
97#endif // YAZE_UTIL_FILE_UTIL_H_
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()
void SaveFile(const std::string &filename, const std::string &contents)
Definition file_util.cc:56
std::string GetFileName(const std::string &filename)
Gets the filename from a full path.
Definition file_util.cc:19
std::string GetResourcePath(const std::string &resource_path)
Definition file_util.cc:70
std::string LoadFileFromConfigDir(const std::string &filename)
Loads a file from the user's config directory.
Definition file_util.cc:38
std::string GetFileExtension(const std::string &filename)
Gets the file extension from a filename.
Definition file_util.cc:15
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.
Definition file_util.cc:23
Main namespace for the application.