Skip to content

Commit

Permalink
Config: Use directory containing bundle as AppRoot on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
squidbus authored and F0bes committed Aug 13, 2024
1 parent 11096a5 commit 185b85f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pcsx2/Pcsx2Config.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
// SPDX-License-Identifier: GPL-3.0+

#include "common/CocoaTools.h"
#include "common/FileSystem.h"
#include "common/Path.h"
#include "common/SettingsInterface.h"
Expand Down Expand Up @@ -1859,7 +1860,15 @@ void Pcsx2Config::ClearInvalidPerGameConfiguration(SettingsInterface* si)

void EmuFolders::SetAppRoot()
{
const std::string program_path = FileSystem::GetProgramPath();
std::string program_path = FileSystem::GetProgramPath();
#ifdef __APPLE__
const auto bundle_path = CocoaTools::GetNonTranslocatedBundlePath();
if (bundle_path.has_value())
{
// On macOS, override with the bundle path if launched from a bundle.
program_path = bundle_path.value();
}
#endif
Console.WriteLnFmt("Program Path: {}", program_path);

AppRoot = Path::Canonicalize(Path::GetDirectory(program_path));
Expand All @@ -1879,7 +1888,8 @@ bool EmuFolders::SetResourcesDirectory()
#endif
#else
// On macOS, this is in the bundle resources directory.
Resources = Path::Canonicalize(Path::Combine(AppRoot, "../Resources"));
const std::string program_path = FileSystem::GetProgramPath();
Resources = Path::Canonicalize(Path::Combine(Path::GetDirectory(program_path), "../Resources"));
#endif

Console.WriteLnFmt("Resources Directory: {}", Resources);
Expand Down

0 comments on commit 185b85f

Please sign in to comment.