Favor project.binary over project.godot

This commit is contained in:
Tomasz Chabora 2020-10-22 00:12:18 +02:00
parent a4548a079b
commit 37d515e99c
1 changed files with 17 additions and 10 deletions

View File

@ -629,19 +629,26 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
}
Error ProjectSettings::_load_settings_text_or_binary(const String &p_text_path, const String &p_bin_path) {
// Attempt first to load the text-based project.godot file
Error err_text = _load_settings_text(p_text_path);
if (err_text == OK) {
// Attempt first to load the binary project.godot file.
Error err = _load_settings_binary(p_bin_path);
if (err == OK) {
return OK;
} else if (err_text != ERR_FILE_NOT_FOUND) {
// If the text-based file exists but can't be loaded, we want to know it
ERR_PRINT("Couldn't load file '" + p_text_path + "', error code " + itos(err_text) + ".");
return err_text;
} else if (err != ERR_FILE_NOT_FOUND) {
// If the file exists but can't be loaded, we want to know it.
ERR_PRINT("Couldn't load file '" + p_bin_path + "', error code " + itos(err) + ".");
return err;
}
// Fallback to binary project.binary file if text-based was not found
Error err_bin = _load_settings_binary(p_bin_path);
return err_bin;
// Fallback to text-based project.godot file if binary was not found.
err = _load_settings_text(p_text_path);
if (err == OK) {
return OK;
} else if (err != ERR_FILE_NOT_FOUND) {
ERR_PRINT("Couldn't load file '" + p_text_path + "', error code " + itos(err) + ".");
return err;
}
return err;
}
int ProjectSettings::get_order(const String &p_name) const {