diff --git a/src/scenedit/scen.main.cpp b/src/scenedit/scen.main.cpp index c2f094f5..a56f9674 100644 --- a/src/scenedit/scen.main.cpp +++ b/src/scenedit/scen.main.cpp @@ -122,16 +122,22 @@ static void launch_scenario(eLaunchType type) { // Prompt to save first if(!save_check("save-before-launch", false)) return; + fs::path app_folder = fs::current_path(); fs::path game_binary; #ifdef SFML_SYSTEM_MACOS game_binary = "Blades of Exile.app/Contents/MacOS/Blades of Exile"; + // Run by double-click on app bundle + if(app_folder == "/"){ + extern fs::path bundlePath(); + app_folder = bundlePath().parent_path(); + } #elif defined(SFML_SYSTEM_WINDOWS) game_binary = "Blades of Exile.exe"; #elif defined(SFML_SYSTEM_LINUX) game_binary = "Blades of Exile"; #endif - game_binary = bp::search_path(game_binary, {fs::current_path()}); + game_binary = bp::search_path(game_binary, {app_folder}); if(game_binary.empty()){ showError("The current working directory does not contain Blades of Exile."); return; diff --git a/src/tools/prefs.mac.mm b/src/tools/prefs.mac.mm index 35ac1683..ac8357f3 100644 --- a/src/tools/prefs.mac.mm +++ b/src/tools/prefs.mac.mm @@ -174,3 +174,8 @@ bool sync_prefs_mac() { return [[NSUserDefaults standardUserDefaults] synchronize]; } +// Used in scen.main.cpp to find BoE app bundle, but uses a static function (convertValue()) in this file. +fs::path bundlePath() { + NSBundle *main = [NSBundle mainBundle]; + return convertValue(main.bundlePath); +}