mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-27 03:49:41 -04:00
chore: update project branding to Citron
Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -56,10 +56,10 @@ namespace fs = std::filesystem;
|
||||
|
||||
/**
|
||||
* The PathManagerImpl is a singleton allowing to manage the mapping of
|
||||
* YuzuPath enums to real filesystem paths.
|
||||
* This class provides 2 functions: GetYuzuPathImpl and SetYuzuPathImpl.
|
||||
* These are used by GetYuzuPath and SetYuzuPath respectively to get or modify
|
||||
* the path mapped by the YuzuPath enum.
|
||||
* CitronPath enums to real filesystem paths.
|
||||
* This class provides 2 functions: GetCitronPathImpl and SetCitronPathImpl.
|
||||
* These are used by GetCitronPath and SetCitronPath respectively to get or modify
|
||||
* the path mapped by the CitronPath enum.
|
||||
*/
|
||||
class PathManagerImpl {
|
||||
public:
|
||||
@@ -75,11 +75,11 @@ public:
|
||||
PathManagerImpl(PathManagerImpl&&) = delete;
|
||||
PathManagerImpl& operator=(PathManagerImpl&&) = delete;
|
||||
|
||||
[[nodiscard]] const fs::path& GetYuzuPathImpl(YuzuPath citron_path) {
|
||||
[[nodiscard]] const fs::path& GetCitronPathImpl(CitronPath citron_path) {
|
||||
return citron_paths.at(citron_path);
|
||||
}
|
||||
|
||||
void SetYuzuPathImpl(YuzuPath citron_path, const fs::path& new_path) {
|
||||
void SetCitronPathImpl(CitronPath citron_path, const fs::path& new_path) {
|
||||
citron_paths.insert_or_assign(citron_path, new_path);
|
||||
}
|
||||
|
||||
@@ -115,22 +115,22 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
GenerateYuzuPath(YuzuPath::YuzuDir, citron_path);
|
||||
GenerateYuzuPath(YuzuPath::AmiiboDir, citron_path / AMIIBO_DIR);
|
||||
GenerateYuzuPath(YuzuPath::CacheDir, citron_path_cache);
|
||||
GenerateYuzuPath(YuzuPath::ConfigDir, citron_path_config);
|
||||
GenerateYuzuPath(YuzuPath::CrashDumpsDir, citron_path / CRASH_DUMPS_DIR);
|
||||
GenerateYuzuPath(YuzuPath::DumpDir, citron_path / DUMP_DIR);
|
||||
GenerateYuzuPath(YuzuPath::KeysDir, citron_path / KEYS_DIR);
|
||||
GenerateYuzuPath(YuzuPath::LoadDir, citron_path / LOAD_DIR);
|
||||
GenerateYuzuPath(YuzuPath::LogDir, citron_path / LOG_DIR);
|
||||
GenerateYuzuPath(YuzuPath::NANDDir, citron_path / NAND_DIR);
|
||||
GenerateYuzuPath(YuzuPath::PlayTimeDir, citron_path / PLAY_TIME_DIR);
|
||||
GenerateYuzuPath(YuzuPath::ScreenshotsDir, citron_path / SCREENSHOTS_DIR);
|
||||
GenerateYuzuPath(YuzuPath::SDMCDir, citron_path / SDMC_DIR);
|
||||
GenerateYuzuPath(YuzuPath::ShaderDir, citron_path / SHADER_DIR);
|
||||
GenerateYuzuPath(YuzuPath::TASDir, citron_path / TAS_DIR);
|
||||
GenerateYuzuPath(YuzuPath::IconsDir, citron_path / ICONS_DIR);
|
||||
GenerateCitronPath(CitronPath::CitronDir, citron_path);
|
||||
GenerateCitronPath(CitronPath::AmiiboDir, citron_path / AMIIBO_DIR);
|
||||
GenerateCitronPath(CitronPath::CacheDir, citron_path_cache);
|
||||
GenerateCitronPath(CitronPath::ConfigDir, citron_path_config);
|
||||
GenerateCitronPath(CitronPath::CrashDumpsDir, citron_path / CRASH_DUMPS_DIR);
|
||||
GenerateCitronPath(CitronPath::DumpDir, citron_path / DUMP_DIR);
|
||||
GenerateCitronPath(CitronPath::KeysDir, citron_path / KEYS_DIR);
|
||||
GenerateCitronPath(CitronPath::LoadDir, citron_path / LOAD_DIR);
|
||||
GenerateCitronPath(CitronPath::LogDir, citron_path / LOG_DIR);
|
||||
GenerateCitronPath(CitronPath::NANDDir, citron_path / NAND_DIR);
|
||||
GenerateCitronPath(CitronPath::PlayTimeDir, citron_path / PLAY_TIME_DIR);
|
||||
GenerateCitronPath(CitronPath::ScreenshotsDir, citron_path / SCREENSHOTS_DIR);
|
||||
GenerateCitronPath(CitronPath::SDMCDir, citron_path / SDMC_DIR);
|
||||
GenerateCitronPath(CitronPath::ShaderDir, citron_path / SHADER_DIR);
|
||||
GenerateCitronPath(CitronPath::TASDir, citron_path / TAS_DIR);
|
||||
GenerateCitronPath(CitronPath::IconsDir, citron_path / ICONS_DIR);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -140,13 +140,13 @@ private:
|
||||
|
||||
~PathManagerImpl() = default;
|
||||
|
||||
void GenerateYuzuPath(YuzuPath citron_path, const fs::path& new_path) {
|
||||
void GenerateCitronPath(CitronPath citron_path, const fs::path& new_path) {
|
||||
void(FS::CreateDir(new_path));
|
||||
|
||||
SetYuzuPathImpl(citron_path, new_path);
|
||||
SetCitronPathImpl(citron_path, new_path);
|
||||
}
|
||||
|
||||
std::unordered_map<YuzuPath, fs::path> citron_paths;
|
||||
std::unordered_map<CitronPath, fs::path> citron_paths;
|
||||
};
|
||||
|
||||
bool ValidatePath(const fs::path& path) {
|
||||
@@ -230,22 +230,22 @@ void SetAppDirectory(const std::string& app_directory) {
|
||||
PathManagerImpl::GetInstance().Reinitialize(app_directory);
|
||||
}
|
||||
|
||||
const fs::path& GetYuzuPath(YuzuPath citron_path) {
|
||||
return PathManagerImpl::GetInstance().GetYuzuPathImpl(citron_path);
|
||||
const fs::path& GetCitronPath(CitronPath citron_path) {
|
||||
return PathManagerImpl::GetInstance().GetCitronPathImpl(citron_path);
|
||||
}
|
||||
|
||||
std::string GetYuzuPathString(YuzuPath citron_path) {
|
||||
return PathToUTF8String(GetYuzuPath(citron_path));
|
||||
std::string GetCitronPathString(CitronPath citron_path) {
|
||||
return PathToUTF8String(GetCitronPath(citron_path));
|
||||
}
|
||||
|
||||
void SetYuzuPath(YuzuPath citron_path, const fs::path& new_path) {
|
||||
void SetCitronPath(CitronPath citron_path, const fs::path& new_path) {
|
||||
if (!FS::IsDir(new_path)) {
|
||||
LOG_ERROR(Common_Filesystem, "Filesystem object at new_path={} is not a directory",
|
||||
PathToUTF8String(new_path));
|
||||
return;
|
||||
}
|
||||
|
||||
PathManagerImpl::GetInstance().SetYuzuPathImpl(citron_path, new_path);
|
||||
PathManagerImpl::GetInstance().SetCitronPathImpl(citron_path, new_path);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
namespace Common::FS {
|
||||
|
||||
enum class YuzuPath {
|
||||
YuzuDir, // Where citron stores its data.
|
||||
enum class CitronPath {
|
||||
CitronDir, // Where citron stores its data.
|
||||
AmiiboDir, // Where Amiibo backups are stored.
|
||||
CacheDir, // Where cached filesystem data is stored.
|
||||
ConfigDir, // Where config files are stored.
|
||||
@@ -193,39 +193,39 @@ 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 CitronPath enum.
|
||||
*
|
||||
* @param citron_path YuzuPath enum
|
||||
* @param citron_path CitronPath enum
|
||||
*
|
||||
* @returns The filesystem path associated with the YuzuPath enum.
|
||||
* @returns The filesystem path associated with the CitronPath enum.
|
||||
*/
|
||||
[[nodiscard]] const std::filesystem::path& GetYuzuPath(YuzuPath citron_path);
|
||||
[[nodiscard]] const std::filesystem::path& GetCitronPath(CitronPath citron_path);
|
||||
|
||||
/**
|
||||
* Gets the filesystem path associated with the YuzuPath enum as a UTF-8 encoded std::string.
|
||||
* Gets the filesystem path associated with the CitronPath enum as a UTF-8 encoded std::string.
|
||||
*
|
||||
* @param citron_path YuzuPath enum
|
||||
* @param citron_path CitronPath enum
|
||||
*
|
||||
* @returns The filesystem path associated with the YuzuPath enum as a UTF-8 encoded std::string.
|
||||
* @returns The filesystem path associated with the CitronPath enum as a UTF-8 encoded std::string.
|
||||
*/
|
||||
[[nodiscard]] std::string GetYuzuPathString(YuzuPath citron_path);
|
||||
[[nodiscard]] std::string GetCitronPathString(CitronPath citron_path);
|
||||
|
||||
/**
|
||||
* Sets a new filesystem path associated with the YuzuPath enum.
|
||||
* Sets a new filesystem path associated with the CitronPath enum.
|
||||
* If the filesystem object at new_path is not a directory, this function will not do anything.
|
||||
*
|
||||
* @param citron_path YuzuPath enum
|
||||
* @param citron_path CitronPath enum
|
||||
* @param new_path New filesystem path
|
||||
*/
|
||||
void SetYuzuPath(YuzuPath citron_path, const std::filesystem::path& new_path);
|
||||
void SetCitronPath(CitronPath citron_path, const std::filesystem::path& new_path);
|
||||
|
||||
#ifdef _WIN32
|
||||
template <typename Path>
|
||||
void SetYuzuPath(YuzuPath citron_path, const Path& new_path) {
|
||||
void SetCitronPath(CitronPath citron_path, const Path& new_path) {
|
||||
if constexpr (IsChar<typename Path::value_type>) {
|
||||
SetYuzuPath(citron_path, ToU8String(new_path));
|
||||
SetCitronPath(citron_path, ToU8String(new_path));
|
||||
} else {
|
||||
SetYuzuPath(citron_path, std::filesystem::path{new_path});
|
||||
SetCitronPath(citron_path, std::filesystem::path{new_path});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -288,11 +288,11 @@ enum class DirectorySeparator {
|
||||
};
|
||||
|
||||
// Splits the path on '/' or '\' and put the components into a vector
|
||||
// i.e. "C:\Users\Yuzu\Documents\save.bin" becomes {"C:", "Users", "Yuzu", "Documents", "save.bin" }
|
||||
// i.e. "C:\Users\Citron\Documents\save.bin" becomes {"C:", "Users", "Citron", "Documents", "save.bin" }
|
||||
[[nodiscard]] std::vector<std::string_view> SplitPathComponents(std::string_view filename);
|
||||
|
||||
// Splits the path on '/' or '\' and put the components into a vector
|
||||
// i.e. "C:\Users\Yuzu\Documents\save.bin" becomes {"C:", "Users", "Yuzu", "Documents", "save.bin" }
|
||||
// i.e. "C:\Users\Citron\Documents\save.bin" becomes {"C:", "Users", "Citron", "Documents", "save.bin" }
|
||||
[[nodiscard]] std::vector<std::string> SplitPathComponentsCopy(std::string_view filename);
|
||||
|
||||
// Removes trailing slash, makes all '\\' into '/', and removes duplicate '/'. Makes '/' into '\\'
|
||||
|
||||
Reference in New Issue
Block a user