Browse Source

Set resource path earlier on ProjectSettings setup

Since loading the config might use the resource path, it needs to be
set before that happens.
George Marques 4 years ago
parent
commit
b25ab27d4a
1 changed files with 3 additions and 4 deletions
  1. 3 4
      core/config/project_settings.cpp

+ 3 - 4
core/config/project_settings.cpp

@@ -467,16 +467,17 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
 	d->change_dir(p_path);
 	d->change_dir(p_path);
 
 
 	String current_dir = d->get_current_dir();
 	String current_dir = d->get_current_dir();
-	String candidate = current_dir;
 	bool found = false;
 	bool found = false;
 	Error err;
 	Error err;
 
 
 	while (true) {
 	while (true) {
+		// Set the resource path early so things can be resolved when loading.
+		resource_path = current_dir;
+		resource_path = resource_path.replace("\\", "/"); // Windows path to Unix path just in case.
 		err = _load_settings_text_or_binary(current_dir.plus_file("project.godot"), current_dir.plus_file("project.binary"));
 		err = _load_settings_text_or_binary(current_dir.plus_file("project.godot"), current_dir.plus_file("project.binary"));
 		if (err == OK) {
 		if (err == OK) {
 			// Optional, we don't mind if it fails.
 			// Optional, we don't mind if it fails.
 			_load_settings_text(current_dir.plus_file("override.cfg"));
 			_load_settings_text(current_dir.plus_file("override.cfg"));
-			candidate = current_dir;
 			found = true;
 			found = true;
 			break;
 			break;
 		}
 		}
@@ -493,8 +494,6 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
 		}
 		}
 	}
 	}
 
 
-	resource_path = candidate;
-	resource_path = resource_path.replace("\\", "/"); // Windows path to Unix path just in case.
 	memdelete(d);
 	memdelete(d);
 
 
 	if (!found) {
 	if (!found) {