[macOS] Place `shadPS4/user` folder in `Application Support`

Attempts to resolve #509
This commit is contained in:
Marcin Mitura 2024-08-30 20:59:08 +02:00
parent 6080066f75
commit 922386baaf
1 changed files with 11 additions and 3 deletions

View File

@ -82,11 +82,19 @@ static std::filesystem::path GetBundleParentDirectory() {
static auto UserPaths = [] {
#ifdef __APPLE__
std::filesystem::current_path(GetBundleParentDirectory());
const auto base_dir = GetBundleParentDirectory();
const auto user_dir = base_dir / "user";
if (std::filesystem::exists(base_dir)) {
return std::filesystem::path{user_dir};
} else {
const auto base_dir = std::filesystem::path(getenv("HOME")) / "Library/Application Support/shadPS4";
const auto user_dir = base_dir / "user";
std::filesystem::create_directories(user_dir);
return user_dir;
}
#endif
std::unordered_map<PathType, fs::path> paths;
const auto user_dir = std::filesystem::current_path() / PORTABLE_DIR;
const auto create_path = [&](PathType shad_path, const fs::path& new_path) {
std::filesystem::create_directory(new_path);
@ -155,4 +163,4 @@ void SetUserPath(PathType shad_path, const fs::path& new_path) {
UserPaths.insert_or_assign(shad_path, new_path);
}
} // namespace Common::FS
} // namespace Common::FS