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(
29 const std::string& default_name = "",
30 const std::string& default_extension = "");
31
32 // Specific implementations for testing
33 static std::string ShowOpenFileDialogNFD();
34 static std::string ShowOpenFileDialogBespoke();
35 static std::string ShowSaveFileDialogNFD(
36 const std::string& default_name = "",
37 const std::string& default_extension = "");
38 static std::string ShowSaveFileDialogBespoke(
39 const std::string& default_name = "",
40 const std::string& default_extension = "");
41 static std::string ShowOpenFolderDialogNFD();
42 static std::string ShowOpenFolderDialogBespoke();
43 static std::vector<std::string> GetSubdirectoriesInFolder(
44 const std::string& folder_path);
45 static std::vector<std::string> GetFilesInFolder(
46 const std::string& folder_path);
47};
48
54
56
65std::string GetFileExtension(const std::string& filename);
66
75std::string GetFileName(const std::string& filename);
76std::string GetResourcePath(const std::string& resource_path);
77void SaveFile(const std::string& filename, const std::string& data);
78
87std::string LoadFile(const std::string& filename);
88
95std::string LoadFileFromConfigDir(const std::string& filename);
96
97} // namespace util
98} // namespace yaze
99
100#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