mirror of
https://github.com/godotengine/godot.git
synced 2025-01-22 18:43:29 -05:00
macOS: search for project file in .app resources
This commit is contained in:
parent
bdf625bd54
commit
50b90604af
1 changed files with 22 additions and 0 deletions
|
@ -648,6 +648,28 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
|||
return err;
|
||||
}
|
||||
|
||||
#ifdef MACOS_ENABLED
|
||||
// Attempt to load project file from macOS .app bundle resources.
|
||||
resource_path = OS::get_singleton()->get_bundle_resource_dir();
|
||||
if (!resource_path.is_empty()) {
|
||||
if (resource_path[resource_path.length() - 1] == '/') {
|
||||
resource_path = resource_path.substr(0, resource_path.length() - 1); // Chop end.
|
||||
}
|
||||
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
ERR_FAIL_COND_V_MSG(d.is_null(), ERR_CANT_CREATE, vformat("Cannot create DirAccess for path '%s'.", resource_path));
|
||||
d->change_dir(resource_path);
|
||||
|
||||
Error err;
|
||||
|
||||
err = _load_settings_text_or_binary(resource_path.path_join("project.godot"), resource_path.path_join("project.binary"));
|
||||
if (err == OK && !p_ignore_override) {
|
||||
// Optional, we don't mind if it fails.
|
||||
_load_settings_text(resource_path.path_join("override.cfg"));
|
||||
return err;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Nothing was found, try to find a project file in provided path (`p_path`)
|
||||
// or, if requested (`p_upwards`) in parent directories.
|
||||
|
||||
|
|
Loading…
Reference in a new issue