diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-26 23:02:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-26 23:02:51 +0200 |
commit | ee461b7295c2e6736994ef33c3ace67355a674f8 (patch) | |
tree | 61b7ad0039dc30a30194f57e612773dc8c009a2b /core | |
parent | 390333e822c95081cfbd837699c8c63370b388dc (diff) | |
parent | e08a2be436d50f1b7c0b08d175d7f9a232668d55 (diff) |
Merge pull request #64925 from RandomShaper/ps_res_path
Determine `ProjectSettings`' resource path early
Diffstat (limited to 'core')
-rw-r--r-- | core/config/project_settings.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 26b683db82..d46e242610 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -442,6 +442,15 @@ void ProjectSettings::_convert_to_last_version(int p_from_version) { * If nothing was found, error out. */ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, bool p_upwards, bool p_ignore_override) { + if (!OS::get_singleton()->get_resource_dir().is_empty()) { + // OS will call ProjectSettings->get_resource_path which will be empty if not overridden! + // If the OS would rather use a specific location, then it will not be empty. + resource_path = OS::get_singleton()->get_resource_dir().replace("\\", "/"); + if (!resource_path.is_empty() && resource_path[resource_path.length() - 1] == '/') { + resource_path = resource_path.substr(0, resource_path.length() - 1); // Chop end. + } + } + // If looking for files in a network client, use it directly if (FileAccessNetworkClient::get_singleton()) { @@ -524,13 +533,6 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b // (Only Android -when reading from pck- and iOS use this.) if (!OS::get_singleton()->get_resource_dir().is_empty()) { - // OS will call ProjectSettings->get_resource_path which will be empty if not overridden! - // If the OS would rather use a specific location, then it will not be empty. - resource_path = OS::get_singleton()->get_resource_dir().replace("\\", "/"); - if (!resource_path.is_empty() && resource_path[resource_path.length() - 1] == '/') { - resource_path = resource_path.substr(0, resource_path.length() - 1); // Chop end. - } - Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary"); if (err == OK && !p_ignore_override) { // Optional, we don't mind if it fails. |