You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
[macOS] Re-add support for the _sc_ inside app bundle. Update docs.
This commit is contained in:
@@ -66,23 +66,25 @@ String _get_mono_user_dir() {
|
||||
if (EditorPaths::get_singleton()) {
|
||||
return EditorPaths::get_singleton()->get_data_dir().path_join("mono");
|
||||
} else {
|
||||
String settings_path;
|
||||
String settings_path = OS::get_singleton()->get_data_path().path_join(OS::get_singleton()->get_godot_dir_name());
|
||||
|
||||
// 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.path_join("..").simplify_path().ends_with("Contents")) {
|
||||
exe_dir = exe_dir.path_join("../../..").simplify_path();
|
||||
}
|
||||
|
||||
Ref<DirAccess> d = DirAccess::create_for_path(exe_dir);
|
||||
|
||||
if (d->file_exists("._sc_") || d->file_exists("_sc_")) {
|
||||
// contain yourself
|
||||
settings_path = exe_dir.path_join("editor_data");
|
||||
} else {
|
||||
settings_path = OS::get_singleton()->get_data_path().path_join(OS::get_singleton()->get_godot_dir_name());
|
||||
}
|
||||
|
||||
// On macOS, look outside .app bundle, since .app bundle is read-only.
|
||||
// Note: This will not work if Gatekeeper path randomization is active.
|
||||
if (OS::get_singleton()->has_feature("macos") && exe_dir.ends_with("MacOS") && exe_dir.path_join("..").simplify_path().ends_with("Contents")) {
|
||||
exe_dir = exe_dir.path_join("../../..").simplify_path();
|
||||
d = DirAccess::create_for_path(exe_dir);
|
||||
if (d->file_exists("._sc_") || d->file_exists("_sc_")) {
|
||||
// contain yourself
|
||||
settings_path = exe_dir.path_join("editor_data");
|
||||
}
|
||||
}
|
||||
|
||||
return settings_path.path_join("mono");
|
||||
|
||||
Reference in New Issue
Block a user