Cross-platform utilities for file system paths. More...
#include <platform_paths.h>
Static Public Member Functions | |
| static std::filesystem::path | GetHomeDirectory () |
| Get the user's home directory in a cross-platform way. | |
| static absl::StatusOr< std::filesystem::path > | GetAppDataDirectory () |
| Get the user-specific application data directory for YAZE. | |
| static absl::StatusOr< std::filesystem::path > | GetConfigDirectory () |
| Get the user-specific configuration directory for YAZE. | |
| static absl::StatusOr< std::filesystem::path > | GetUserDocumentsDirectory () |
| Get the user's Documents directory. | |
| 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 > | GetAppDataSubdirectory (const std::string &subdir) |
| Get a subdirectory within the app data folder. | |
| static absl::Status | EnsureDirectoryExists (const std::filesystem::path &path) |
| Ensure a directory exists, creating it if necessary. | |
| static bool | Exists (const std::filesystem::path &path) |
| Check if a file or directory exists. | |
| static absl::StatusOr< std::filesystem::path > | GetTempDirectory () |
| Get a temporary directory for the application. | |
| static std::string | NormalizePathForDisplay (const std::filesystem::path &path) |
| Normalize path separators for display. | |
| static std::string | ToNativePath (const std::filesystem::path &path) |
| Convert path to native format. | |
| static absl::StatusOr< std::filesystem::path > | FindAsset (const std::string &relative_path) |
| Find an asset file in multiple standard locations. | |
Cross-platform utilities for file system paths.
Provides consistent, platform-independent file and directory operations that work correctly on Windows (MSVC), macOS, and Linux.
Definition at line 18 of file platform_paths.h.
|
static |
Get the user's home directory in a cross-platform way.
Definition at line 24 of file platform_paths.cc.
Referenced by FindAsset(), GetAppDataDirectory(), and GetUserDocumentsDirectory().
|
static |
Get the user-specific application data directory for YAZE.
This is the standard location for storing user-specific data, settings, and cache files. The directory is created if it doesn't exist.
APPDATA%\yaze (e.g., C:\Users\user\AppData\Roaming\yaze)~/.yazeDefinition at line 78 of file platform_paths.cc.
References EnsureDirectoryExists(), and GetHomeDirectory().
Referenced by GetAppDataSubdirectory(), and GetConfigDirectory().

|
static |
Get the user-specific configuration directory for YAZE.
This is the standard location for storing user configuration files. The directory is created if it doesn't exist.
APPDATA%\yaze~/.yazeDefinition at line 123 of file platform_paths.cc.
References GetAppDataDirectory().
Referenced by yaze::project::RecentFilesManager::GetFilePath(), yaze::editor::AgentEditor::GetProfilesDirectory(), yaze::gui::ThemeManager::GetThemeSearchPaths(), yaze::util::LoadFileFromConfigDir(), yaze::editor::PanelManager::LoadPresetsFromFile(), yaze::editor::WorkspaceManager::RefreshPresets(), yaze::project::RecentFilesManager::Save(), yaze::util::SaveFile(), yaze::editor::PanelManager::SavePresetsToFile(), yaze::editor::AgentCollaborationCoordinator::SessionsDirectory(), and yaze::editor::UserSettings::UserSettings().

|
static |
Get the user's Documents directory.
This is a visible, user-facing directory for storing projects, logs, and resources the user might want to access or share.
My Documents\Yaze~/Documents/YazeDefinition at line 129 of file platform_paths.cc.
References EnsureDirectoryExists(), and GetHomeDirectory().
Referenced by GetUserDocumentsSubdirectory().

|
static |
Get a subdirectory within the user documents folder.
Creates the directory if it doesn't exist.
| subdir | Subdirectory name (e.g., "logs", "agent") |
Definition at line 169 of file platform_paths.cc.
References EnsureDirectoryExists(), and GetUserDocumentsDirectory().
Referenced by yaze::cli::agent::LearnedKnowledgeService::LearnedKnowledgeService(), and main().

|
static |
Get a subdirectory within the app data folder.
Creates the directory if it doesn't exist.
| subdir | Subdirectory name (e.g., "agent", "cache", "logs") |
Definition at line 184 of file platform_paths.cc.
References EnsureDirectoryExists(), and GetAppDataDirectory().
Referenced by yaze::util::CrashHandler::GetCrashLogDirectory(), and yaze::cli::agent::TodoManager::TodoManager().

|
static |
Ensure a directory exists, creating it if necessary.
Uses std::filesystem::create_directories which works cross-platform.
| path | Directory path to create |
Definition at line 201 of file platform_paths.cc.
References Exists().
Referenced by GetAppDataDirectory(), GetAppDataSubdirectory(), GetTempDirectory(), GetUserDocumentsDirectory(), GetUserDocumentsSubdirectory(), yaze::cli::agent::LearnedKnowledgeService::Initialize(), and yaze::cli::agent::TodoManager::Initialize().

|
static |
Check if a file or directory exists.
| path | Path to check |
Definition at line 219 of file platform_paths.cc.
Referenced by EnsureDirectoryExists(), yaze::cli::agent::anonymous_namespace{learned_knowledge_service.cc}::FileExists(), yaze::cli::agent::TodoManager::Initialize(), yaze::editor::UserSettings::Load(), and yaze::editor::PanelManager::LoadPresetsFromFile().
|
static |
Get a temporary directory for the application.
Definition at line 225 of file platform_paths.cc.
References EnsureDirectoryExists().
Referenced by yaze::util::CrashHandler::GetCrashLogDirectory().

|
static |
Normalize path separators for display.
Converts all path separators to forward slashes for consistent output in logs and UI (forward slashes work on all platforms).
| path | Path to normalize |
Definition at line 249 of file platform_paths.cc.
|
static |
Convert path to native format.
Ensures path uses the correct separator for the current platform.
| path | Path to convert |
Definition at line 257 of file platform_paths.cc.
|
static |
Find an asset file in multiple standard locations.
Searches for an asset file in the following order:
| relative_path | Path relative to assets directory (e.g., "agent/prompt_catalogue.yaml") |
Definition at line 262 of file platform_paths.cc.
References GetHomeDirectory().
Referenced by yaze::cli::PromptBuilder::BuildConstraintsSection(), yaze::editor::SettingsPanel::DrawPatchSettings(), and yaze::cli::PromptBuilder::ResolveCataloguePath().
