diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-05-04 16:14:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-04 16:14:39 +0200 |
commit | 97c787b84df643821e6cad194f21d000532eed23 (patch) | |
tree | d00b141a00e72b7b2dfd8c074cb4c01b7509f83a /core | |
parent | 69f36cea8c5e706125ab419f8e845d3aa657f373 (diff) | |
parent | fba98950c710f72c0eef5354f28977c34724c240 (diff) |
Merge pull request #37937 from HaSa1002/fix-pck
Priorize Embedded PCKs on loading
Diffstat (limited to 'core')
-rw-r--r-- | core/project_settings.cpp | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 63b52661b4..8829181489 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -362,40 +362,29 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b // We need to test both possibilities as extensions for Linux binaries are optional // (so both 'mygame.bin' and 'mygame' should be able to find 'mygame.pck'). - bool found = false; - String exec_dir = exec_path.get_base_dir(); String exec_filename = exec_path.get_file(); String exec_basename = exec_filename.get_basename(); - // Try to load data pack at the location of the executable - // As mentioned above, we have two potential names to attempt - - if (_load_resource_pack(exec_dir.plus_file(exec_basename + ".pck")) || - _load_resource_pack(exec_dir.plus_file(exec_filename + ".pck"))) { - found = true; - } else { - // If we couldn't find them next to the executable, we attempt - // the current working directory. Same story, two tests. - if (_load_resource_pack(exec_basename + ".pck") || - _load_resource_pack(exec_filename + ".pck")) { - found = true; - } - } + // Attempt with PCK bundled into executable + bool found = _load_resource_pack(exec_path); #ifdef OSX_ENABLED - // Attempt to load PCK from macOS .app bundle resources if (!found) { - if (_load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_basename + ".pck"))) { - found = true; - } + // Attempt to load PCK from macOS .app bundle resources + found = _load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_basename + ".pck")); } #endif - // Attempt with PCK bundled into executable if (!found) { - if (_load_resource_pack(exec_path)) { - found = true; + // Try to load data pack at the location of the executable + // As mentioned above, we have two potential names to attempt + found = _load_resource_pack(exec_dir.plus_file(exec_basename + ".pck")) || _load_resource_pack(exec_dir.plus_file(exec_filename + ".pck")); + + if (!found) { + // If we couldn't find them next to the executable, we attempt + // the current working directory. Same story, two tests. + found = _load_resource_pack(exec_basename + ".pck") || _load_resource_pack(exec_filename + ".pck"); } } |