mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
[macOS] Re-add support for the _sc_ inside app bundle. Update docs.
(cherry picked from commit 174e0837e0)
This commit is contained in:
parent
3cae980c17
commit
24c4b5e8ad
3 changed files with 25 additions and 15 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue