You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
macOS: search for project file in .app resources
This commit is contained in:
@@ -648,6 +648,28 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
|||||||
return err;
|
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`)
|
// Nothing was found, try to find a project file in provided path (`p_path`)
|
||||||
// or, if requested (`p_upwards`) in parent directories.
|
// or, if requested (`p_upwards`) in parent directories.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user