mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-17 17:05:02 +00:00
fix: Only change macOS working directory for app bundle.
This commit is contained in:
parent
96bee58d0f
commit
b1ebb2fec5
1 changed files with 5 additions and 3 deletions
|
@ -60,7 +60,7 @@ static CFURLRef UntranslocateBundlePath(const CFURLRef bundle_path) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::filesystem::path GetBundleParentDirectory() {
|
static std::optional<std::filesystem::path> GetBundleParentDirectory() {
|
||||||
if (CFBundleRef bundle_ref = CFBundleGetMainBundle()) {
|
if (CFBundleRef bundle_ref = CFBundleGetMainBundle()) {
|
||||||
if (CFURLRef bundle_url_ref = CFBundleCopyBundleURL(bundle_ref)) {
|
if (CFURLRef bundle_url_ref = CFBundleCopyBundleURL(bundle_ref)) {
|
||||||
SCOPE_EXIT {
|
SCOPE_EXIT {
|
||||||
|
@ -83,14 +83,16 @@ static std::filesystem::path GetBundleParentDirectory() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return std::filesystem::current_path();
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static auto UserPaths = [] {
|
static auto UserPaths = [] {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// Set the current path to the directory containing the app bundle.
|
// Set the current path to the directory containing the app bundle.
|
||||||
std::filesystem::current_path(GetBundleParentDirectory());
|
if (const auto bundle_dir = GetBundleParentDirectory()) {
|
||||||
|
std::filesystem::current_path(*bundle_dir);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Try the portable user directory first.
|
// Try the portable user directory first.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue