1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

[macOS] Fix self-contained mode, by looking for ._sc_ and writing data to the bundle directory instead of executable directory.

This commit is contained in:
bruvzg
2022-01-13 21:17:20 +02:00
parent d13c3c9296
commit fff3c38af9
2 changed files with 12 additions and 0 deletions

View File

@@ -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_")) {