savedata: Fix missing uses of config based save data dir. (#2971)

This commit is contained in:
squidbus 2025-05-22 01:28:41 -07:00 committed by GitHub
parent 786ad6f71e
commit 6935b24440
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 7 additions and 12 deletions

View file

@ -154,7 +154,7 @@ bool GetLoadGameSizeEnabled() {
std::filesystem::path GetSaveDataPath() { std::filesystem::path GetSaveDataPath() {
if (save_data_path.empty()) { if (save_data_path.empty()) {
return Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir); return Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "savedata";
} }
return save_data_path; return save_data_path;
} }

View file

@ -128,7 +128,6 @@ static auto UserPaths = [] {
create_path(PathType::LogDir, user_dir / LOG_DIR); create_path(PathType::LogDir, user_dir / LOG_DIR);
create_path(PathType::ScreenshotsDir, user_dir / SCREENSHOTS_DIR); create_path(PathType::ScreenshotsDir, user_dir / SCREENSHOTS_DIR);
create_path(PathType::ShaderDir, user_dir / SHADER_DIR); create_path(PathType::ShaderDir, user_dir / SHADER_DIR);
create_path(PathType::SaveDataDir, user_dir / SAVEDATA_DIR);
create_path(PathType::GameDataDir, user_dir / GAMEDATA_DIR); create_path(PathType::GameDataDir, user_dir / GAMEDATA_DIR);
create_path(PathType::TempDataDir, user_dir / TEMPDATA_DIR); create_path(PathType::TempDataDir, user_dir / TEMPDATA_DIR);
create_path(PathType::SysModuleDir, user_dir / SYSMODULES_DIR); create_path(PathType::SysModuleDir, user_dir / SYSMODULES_DIR);

View file

@ -18,7 +18,6 @@ enum class PathType {
LogDir, // Where log files are stored. LogDir, // Where log files are stored.
ScreenshotsDir, // Where screenshots are stored. ScreenshotsDir, // Where screenshots are stored.
ShaderDir, // Where shaders are stored. ShaderDir, // Where shaders are stored.
SaveDataDir, // Where guest save data is stored.
TempDataDir, // Where game temp data is stored. TempDataDir, // Where game temp data is stored.
GameDataDir, // Where game data is stored. GameDataDir, // Where game data is stored.
SysModuleDir, // Where system modules are stored. SysModuleDir, // Where system modules are stored.
@ -36,7 +35,6 @@ constexpr auto PORTABLE_DIR = "user";
constexpr auto LOG_DIR = "log"; constexpr auto LOG_DIR = "log";
constexpr auto SCREENSHOTS_DIR = "screenshots"; constexpr auto SCREENSHOTS_DIR = "screenshots";
constexpr auto SHADER_DIR = "shader"; constexpr auto SHADER_DIR = "shader";
constexpr auto SAVEDATA_DIR = "savedata";
constexpr auto GAMEDATA_DIR = "data"; constexpr auto GAMEDATA_DIR = "data";
constexpr auto TEMPDATA_DIR = "temp"; constexpr auto TEMPDATA_DIR = "temp";
constexpr auto SYSMODULES_DIR = "sys_modules"; constexpr auto SYSMODULES_DIR = "sys_modules";

View file

@ -8,6 +8,7 @@
#include <magic_enum/magic_enum.hpp> #include <magic_enum/magic_enum.hpp>
#include "common/assert.h" #include "common/assert.h"
#include "common/config.h"
#include "common/cstring.h" #include "common/cstring.h"
#include "common/elf_info.h" #include "common/elf_info.h"
#include "common/enum.h" #include "common/enum.h"
@ -438,7 +439,7 @@ static Error saveDataMount(const OrbisSaveDataMount2* mount_info,
LOG_INFO(Lib_SaveData, "called with invalid block size"); LOG_INFO(Lib_SaveData, "called with invalid block size");
} }
const auto root_save = Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir); const auto root_save = Config::GetSaveDataPath();
fs::create_directories(root_save); fs::create_directories(root_save);
const auto available = fs::space(root_save).available; const auto available = fs::space(root_save).available;

View file

@ -156,11 +156,9 @@ public:
} }
if (selected == openSaveDataFolder) { if (selected == openSaveDataFolder) {
QString userPath; QString saveDataPath;
Common::FS::PathToQString(userPath, Common::FS::PathToQString(saveDataPath,
Common::FS::GetUserPath(Common::FS::PathType::UserDir)); Config::GetSaveDataPath() / "1" / m_games[itemID].save_dir);
QString saveDataPath =
userPath + "/savedata/1/" + QString::fromStdString(m_games[itemID].save_dir);
QDir(saveDataPath).mkpath(saveDataPath); QDir(saveDataPath).mkpath(saveDataPath);
QDesktopServices::openUrl(QUrl::fromLocalFile(saveDataPath)); QDesktopServices::openUrl(QUrl::fromLocalFile(saveDataPath));
} }
@ -485,8 +483,7 @@ public:
dlc_path, Config::getAddonInstallDir() / dlc_path, Config::getAddonInstallDir() /
Common::FS::PathFromQString(folder_path).parent_path().filename()); Common::FS::PathFromQString(folder_path).parent_path().filename());
Common::FS::PathToQString(save_data_path, Common::FS::PathToQString(save_data_path,
Common::FS::GetUserPath(Common::FS::PathType::UserDir) / Config::GetSaveDataPath() / "1" / m_games[itemID].save_dir);
"savedata/1" / m_games[itemID].serial);
Common::FS::PathToQString(trophy_data_path, Common::FS::PathToQString(trophy_data_path,
Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) / Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) /