diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index e14d01e0b..65071e251 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -306,7 +306,7 @@ void Config::ReadDataStorageValues() { Settings::values.nand_dir = ReadSetting(QStringLiteral("nand_directory"), QString::fromStdString(nan_dir)) .toString() .toStdString(); - std::string sdmc_dir = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir); + std::string sdmc_dir = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir); Settings::values.sdmc_dir = ReadSetting(QStringLiteral("sdmc_directory"), QString::fromStdString(sdmc_dir)) .toString() .toStdString(); diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 9901141b3..b7576c208 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -12,6 +12,7 @@ #include "common/common_paths.h" #include "common/file_util.h" #include "common/logging/log.h" +#include "core/settings.h" #ifdef _WIN32 #include @@ -716,8 +717,13 @@ void SetUserPath(const std::string& path) { } #endif } - g_paths.emplace(UserPath::SDMCDir, user_path + SDMC_DIR DIR_SEP); - g_paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP); + + g_paths.emplace(UserPath::SDMCDir, !Settings::values.sdmc_dir.empty() + ? Settings::values.sdmc_dir + : user_path + SDMC_DIR DIR_SEP); + g_paths.emplace(UserPath::NANDDir, !Settings::values.nand_dir.empty() + ? Settings::values.nand_dir + : user_path + NAND_DIR DIR_SEP); g_paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP); // TODO: Put the logs in a better location for each OS g_paths.emplace(UserPath::LogDir, user_path + LOG_DIR DIR_SEP); @@ -762,6 +768,11 @@ const std::string& GetUserPath(UserPath path) { SetUserPath(); return g_paths[path]; } + +const void UpdateUserPath(UserPath path, const std::string& filename) { + g_paths[path] = filename + DIR_SEP; +} + std::size_t WriteStringToFile(bool text_file, const std::string& filename, std::string_view str) { return IOFile(filename, text_file ? "w" : "wb").WriteString(str); } diff --git a/src/common/file_util.h b/src/common/file_util.h index 6fa14315c..0f0e862c3 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -186,6 +186,9 @@ void SetCurrentRomPath(const std::string& path); // directory. To be used in "multi-user" mode (that is, installed). [[nodiscard]] const std::string& GetUserPath(UserPath path); +// Update the Global Path with the new value +const void UpdateUserPath(UserPath path, const std::string& filename); + // Returns the path to where the sys file are [[nodiscard]] std::string GetSysDirectory(); diff --git a/src/core/settings.cpp b/src/core/settings.cpp index ba2a170eb..855307ba5 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -118,6 +118,8 @@ void LogSettings() { log_setting("Camera_OuterLeftConfig", values.camera_config[OuterLeftCamera]); log_setting("Camera_OuterLeftFlip", values.camera_flip[OuterLeftCamera]); log_setting("DataStorage_UseVirtualSd", values.use_virtual_sd); + log_setting("DataStorage_SdmcDir", values.sdmc_dir); + log_setting("DataStorage_NandDir", values.nand_dir); log_setting("System_IsNew3ds", values.is_new_3ds); log_setting("System_RegionValue", values.region_value); log_setting("Debugging_UseGdbstub", values.use_gdbstub);