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 > | GetImGuiIniPath () |
| Get the ImGui ini path 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 31 of file platform_paths.cc.
Referenced by yaze::editor::SettingsPanel::DrawAIAgentSettings(), yaze::editor::anonymous_namespace{agent_editor.cc}::ExpandUserPath(), 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.
~/.yaze (user home, cross-platform consistency)Definition at line 85 of file platform_paths.cc.
References EnsureDirectoryExists(), Exists(), and GetHomeDirectory().
Referenced by yaze::editor::ProjectManagementPanel::DrawStorageLocations(), 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.
~/.yaze (user home, cross-platform consistency)Definition at line 234 of file platform_paths.cc.
References GetAppDataDirectory().
Referenced by yaze::editor::UICoordinator::DrawCommandPalette(), yaze::project::RecentFilesManager::GetFilePath(), GetImGuiIniPath(), yaze::gui::ThemeManager::GetThemeSearchPaths(), yaze::gui::ThemeManager::GetUserThemesDirectory(), yaze::editor::UICoordinator::InitializeCommandPalette(), yaze::util::LoadFileFromConfigDir(), yaze::editor::PanelManager::LoadPresetsFromFile(), yaze::project::RecentFilesManager::Save(), yaze::util::SaveFile(), yaze::editor::PanelManager::SavePresetsToFile(), and yaze::editor::UserSettings::UserSettings().

|
static |
Get the ImGui ini path for YAZE.
This ensures imgui.ini lives in the app config directory rather than the current working directory.
Definition at line 240 of file platform_paths.cc.
References GetConfigDirectory().
Referenced by yaze::core::CreateWindow(), yaze::platform::IOSWindowBackend::InitializeImGui(), yaze::platform::SDL2WindowBackend::InitializeImGui(), yaze::editor::WindowDelegate::ResetLayout(), yaze::editor::LayoutCoordinator::ResetWorkspaceLayout(), and yaze::editor::WorkspaceManager::ResetWorkspaceLayout().

|
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 249 of file platform_paths.cc.
References EnsureDirectoryExists(), and GetHomeDirectory().
Referenced by yaze::editor::SettingsPanel::DrawFilesystemSettings(), GetUserDocumentsSubdirectory(), and yaze::editor::UserSettings::UserSettings().

|
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 302 of file platform_paths.cc.
References EnsureDirectoryExists(), and GetUserDocumentsDirectory().
Referenced by yaze::editor::SettingsPanel::DrawFilesystemSettings().

|
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 316 of file platform_paths.cc.
References EnsureDirectoryExists(), and GetAppDataDirectory().
Referenced by yaze::cli::anonymous_namespace{proposal_registry.cc}::DetermineDefaultRoot(), yaze::cli::anonymous_namespace{rom_sandbox_manager.cc}::DetermineDefaultRoot(), yaze::editor::WindowDelegate::GetAvailableLayouts(), yaze::util::CrashHandler::GetCrashLogDirectory(), yaze::editor::WindowDelegate::GetLayoutFilePath(), yaze::editor::anonymous_namespace{layout_manager.cc}::GetLayoutsFilePath(), yaze::editor::AgentEditor::GetProfilesDirectory(), yaze::emu::render::SaveStateManager::Initialize(), yaze::cli::agent::LearnedKnowledgeService::LearnedKnowledgeService(), yaze::cli::PolicyEvaluator::LoadPolicies(), yaze::editor::WindowDelegate::LoadWorkspaceLayout(), yaze::editor::WorkspaceManager::LoadWorkspacePreset(), main(), yaze::editor::WorkspaceManager::RefreshPresets(), yaze::editor::anonymous_namespace{agent_chat.cc}::ResolveAgentChatHistoryPath(), yaze::editor::anonymous_namespace{right_panel_manager.cc}::ResolveAgentChatHistoryPath(), yaze::gui::anonymous_namespace{agent_chat_widget.cc}::ResolveAgentChatHistoryPath(), yaze::editor::anonymous_namespace{agent_chat.cc}::ResolveAgentSessionsDir(), ResolveLogConfig(), yaze::editor::WindowDelegate::SaveWorkspaceLayout(), yaze::editor::WorkspaceManager::SaveWorkspacePreset(), yaze::editor::AgentCollaborationCoordinator::SessionsDirectory(), 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 333 of file platform_paths.cc.
References Exists().
Referenced by yaze::editor::anonymous_namespace{user_settings.cc}::EnsureParentDirectory(), GetAppDataDirectory(), GetAppDataSubdirectory(), yaze::editor::anonymous_namespace{layout_manager.cc}::GetLayoutsFilePath(), GetTempDirectory(), yaze::gui::ThemeManager::GetThemeSearchPaths(), GetUserDocumentsDirectory(), GetUserDocumentsSubdirectory(), yaze::gui::ThemeManager::GetUserThemesDirectory(), yaze::cli::agent::LearnedKnowledgeService::Initialize(), yaze::cli::agent::TodoManager::Initialize(), and yaze::editor::LayoutManager::SaveLayoutsToDisk().

|
static |
Check if a file or directory exists.
| path | Path to check |
Definition at line 351 of file platform_paths.cc.
Referenced by EnsureDirectoryExists(), yaze::cli::agent::anonymous_namespace{learned_knowledge_service.cc}::FileExists(), GetAppDataDirectory(), 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 357 of file platform_paths.cc.
References EnsureDirectoryExists().
Referenced by yaze::editor::ProjectManagementPanel::DrawStorageLocations(), yaze::util::CrashHandler::GetCrashLogDirectory(), yaze::editor::AgentEditor::GetProfilesDirectory(), yaze::cli::agent::LearnedKnowledgeService::LearnedKnowledgeService(), yaze::editor::anonymous_namespace{agent_chat.cc}::ResolveAgentChatHistoryPath(), yaze::editor::anonymous_namespace{right_panel_manager.cc}::ResolveAgentChatHistoryPath(), yaze::gui::anonymous_namespace{agent_chat_widget.cc}::ResolveAgentChatHistoryPath(), and yaze::editor::AgentCollaborationCoordinator::SessionsDirectory().

|
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 381 of file platform_paths.cc.
Referenced by yaze::editor::SettingsPanel::DrawAIAgentSettings(), yaze::editor::SettingsPanel::DrawFilesystemSettings(), and yaze::editor::ProjectManagementPanel::DrawStorageLocations().
|
static |
Convert path to native format.
Ensures path uses the correct separator for the current platform.
| path | Path to convert |
Definition at line 389 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 394 of file platform_paths.cc.
References GetHomeDirectory().
Referenced by yaze::cli::PromptBuilder::BuildConstraintsSection(), yaze::editor::SettingsPanel::DrawPatchSettings(), and yaze::cli::PromptBuilder::ResolveCataloguePath().
