yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
platform_paths.h
Go to the documentation of this file.
1#ifndef YAZE_UTIL_PLATFORM_PATHS_H_
2#define YAZE_UTIL_PLATFORM_PATHS_H_
3
4#include <filesystem>
5#include <string>
6
7#include "absl/status/statusor.h"
8
9namespace yaze {
10namespace util {
11
19 public:
20 // Resolves the running native executable, independent of the working
21 // directory or PATH. Used to bind file receipts to the actual producer.
22 static absl::StatusOr<std::filesystem::path> GetExecutablePath();
23
33 static std::filesystem::path GetHomeDirectory();
34
47 static absl::StatusOr<std::filesystem::path> GetAppDataDirectory();
48
60 static absl::StatusOr<std::filesystem::path> GetConfigDirectory();
61
70 static absl::StatusOr<std::filesystem::path> GetImGuiIniPath();
71
85 static absl::StatusOr<std::filesystem::path> GetUserDocumentsDirectory();
86
95 static absl::StatusOr<std::filesystem::path> GetUserDocumentsSubdirectory(
96 const std::string& subdir);
97
106 static absl::StatusOr<std::filesystem::path> GetAppDataSubdirectory(
107 const std::string& subdir);
108
117 static absl::Status EnsureDirectoryExists(const std::filesystem::path& path);
118
125 static bool Exists(const std::filesystem::path& path);
126
135 static absl::StatusOr<std::filesystem::path> GetTempDirectory();
136
146 static std::string NormalizePathForDisplay(const std::filesystem::path& path);
147
156 static std::string ToNativePath(const std::filesystem::path& path);
157
177 static absl::StatusOr<std::filesystem::path> FindAsset(
178 const std::string& relative_path);
179};
180
181} // namespace util
182} // namespace yaze
183
184#endif // YAZE_UTIL_PLATFORM_PATHS_H_
Cross-platform utilities for file system paths.
static absl::StatusOr< std::filesystem::path > GetImGuiIniPath()
Get the ImGui ini path for YAZE.
static absl::StatusOr< std::filesystem::path > GetExecutablePath()
static absl::StatusOr< std::filesystem::path > GetTempDirectory()
Get a temporary directory for the application.
static absl::StatusOr< std::filesystem::path > GetAppDataDirectory()
Get the user-specific application data directory for YAZE.
static absl::StatusOr< std::filesystem::path > GetAppDataSubdirectory(const std::string &subdir)
Get a subdirectory within the app data folder.
static std::string ToNativePath(const std::filesystem::path &path)
Convert path to native format.
static absl::StatusOr< std::filesystem::path > GetConfigDirectory()
Get the user-specific configuration directory for YAZE.
static absl::StatusOr< std::filesystem::path > GetUserDocumentsSubdirectory(const std::string &subdir)
Get a subdirectory within the user documents folder.
static absl::StatusOr< std::filesystem::path > GetUserDocumentsDirectory()
Get the user's Documents directory.
static absl::StatusOr< std::filesystem::path > FindAsset(const std::string &relative_path)
Find an asset file in multiple standard locations.
static absl::Status EnsureDirectoryExists(const std::filesystem::path &path)
Ensure a directory exists, creating it if necessary.
static std::string NormalizePathForDisplay(const std::filesystem::path &path)
Normalize path separators for display.
static bool Exists(const std::filesystem::path &path)
Check if a file or directory exists.
static std::filesystem::path GetHomeDirectory()
Get the user's home directory in a cross-platform way.