Skip to content

Commit

Permalink
Merge pull request godotengine#56762 from bruvzg/mac_fix_sc
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Jan 14, 2022
2 parents d5fb68b + fff3c38 commit afaf0c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions editor/editor_paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ EditorPaths::EditorPaths() {

// Self-contained mode if a `._sc_` or `_sc_` file is present in executable dir.
String exe_path = OS::get_singleton()->get_executable_path().get_base_dir();

// On macOS, look outside .app bundle, since .app bundle is read-only.
if (OS::get_singleton()->has_feature("macos") && exe_path.ends_with("MacOS") && exe_path.plus_file("..").simplify_path().ends_with("Contents")) {
exe_path = exe_path.plus_file("../../..").simplify_path();
}
{
DirAccessRef d = DirAccess::create_for_path(exe_path);

Expand Down
7 changes: 7 additions & 0 deletions modules/mono/godotsharp_dirs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ String _get_mono_user_dir() {
} else {
String settings_path;

// Self-contained mode if a `._sc_` or `_sc_` file is present in executable dir.
String exe_dir = OS::get_singleton()->get_executable_path().get_base_dir();

// On macOS, look outside .app bundle, since .app bundle is read-only.
if (OS::get_singleton()->has_feature("macos") && exe_dir.ends_with("MacOS") && exe_dir.plus_file("..").simplify_path().ends_with("Contents")) {
exe_dir = exe_dir.plus_file("../../..").simplify_path();
}

DirAccessRef d = DirAccess::create_for_path(exe_dir);

if (d->file_exists("._sc_") || d->file_exists("_sc_")) {
Expand Down

0 comments on commit afaf0c9

Please sign in to comment.