diff options
Diffstat (limited to 'src/common/fs/path_util.h')
| -rw-r--r-- | src/common/fs/path_util.h | 76 |
1 files changed, 60 insertions, 16 deletions
diff --git a/src/common/fs/path_util.h b/src/common/fs/path_util.h index 59301e7edd..1dd95391f7 100644 --- a/src/common/fs/path_util.h +++ b/src/common/fs/path_util.h @@ -1,6 +1,9 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2025 eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + #pragma once #include <filesystem> @@ -10,8 +13,8 @@ namespace Common::FS { -enum class YuzuPath { - YuzuDir, // Where yuzu stores its data. +enum class EdenPath { + EdenDir, // Where yuzu stores its data. AmiiboDir, // Where Amiibo backups are stored. CacheDir, // Where cached filesystem data is stored. ConfigDir, // Where config files are stored. @@ -29,6 +32,24 @@ enum class YuzuPath { IconsDir, // Where Icons for Windows shortcuts are stored. }; +enum LegacyPath { + CitronDir, // Citron Directories for migration + CitronConfigDir, + CitronCacheDir, + + SudachiDir, // Sudachi Directories for migration + SudachiConfigDir, + SudachiCacheDir, + + YuzuDir, // Yuzu Directories for migration + YuzuConfigDir, + YuzuCacheDir, + + SuyuDir, // Suyu Directories for migration + SuyuConfigDir, + SuyuCacheDir, +}; + /** * Validates a given path. * @@ -193,39 +214,62 @@ template <typename Path> void SetAppDirectory(const std::string& app_directory); /** - * Gets the filesystem path associated with the YuzuPath enum. + * Gets the filesystem path associated with the EdenPath enum. * - * @param yuzu_path YuzuPath enum + * @param eden_path EdenPath enum * - * @returns The filesystem path associated with the YuzuPath enum. + * @returns The filesystem path associated with the EdenPath enum. */ -[[nodiscard]] const std::filesystem::path& GetYuzuPath(YuzuPath yuzu_path); +[[nodiscard]] const std::filesystem::path& GetEdenPath(EdenPath eden_path); /** - * Gets the filesystem path associated with the YuzuPath enum as a UTF-8 encoded std::string. + * Gets the filesystem path associated with the LegacyPath enum. * - * @param yuzu_path YuzuPath enum + * @param legacy_path LegacyPath enum * - * @returns The filesystem path associated with the YuzuPath enum as a UTF-8 encoded std::string. + * @returns The filesystem path associated with the LegacyPath enum. */ -[[nodiscard]] std::string GetYuzuPathString(YuzuPath yuzu_path); +[[nodiscard]] const std::filesystem::path& GetLegacyPath(LegacyPath legacy_path); /** - * Sets a new filesystem path associated with the YuzuPath enum. + * Gets the filesystem path associated with the EdenPath enum as a UTF-8 encoded std::string. + * + * @param eden_path EdenPath enum + * + * @returns The filesystem path associated with the EdenPath enum as a UTF-8 encoded std::string. + */ +[[nodiscard]] std::string GetEdenPathString(EdenPath eden_path); + +/** + * Gets the filesystem path associated with the LegacyPath enum as a UTF-8 encoded std::string. + * + * @param legacy_path LegacyPath enum + * + * @returns The filesystem path associated with the LegacyPath enum as a UTF-8 encoded std::string. + */ +[[nodiscard]] std::string GetLegacyPathString(LegacyPath legacy_path); + +/** + * Sets a new filesystem path associated with the EdenPath enum. * If the filesystem object at new_path is not a directory, this function will not do anything. * - * @param yuzu_path YuzuPath enum + * @param eden_path EdenPath enum * @param new_path New filesystem path */ -void SetYuzuPath(YuzuPath yuzu_path, const std::filesystem::path& new_path); +void SetEdenPath(EdenPath eden_path, const std::filesystem::path& new_path); + +/** + * Creates all necessary Eden paths in the filesystem. + */ +void CreateEdenPaths(); #ifdef _WIN32 template <typename Path> -void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) { +void SetEdenPath(EdenPath eden_path, const Path& new_path) { if constexpr (IsChar<typename Path::value_type>) { - SetYuzuPath(yuzu_path, ToU8String(new_path)); + SetEdenPath(eden_path, ToU8String(new_path)); } else { - SetYuzuPath(yuzu_path, std::filesystem::path{new_path}); + SetEdenPath(eden_path, std::filesystem::path{new_path}); } } #endif |
