2
0
Эх сурвалжийг харах

Allow to save override.cfg with ProjectSettings

(cherry picked from commit 156c402f2bfd391f2b1160710ff206f4427b8501)
kobewi 4 жил өмнө
parent
commit
e9e0cac3f5

+ 3 - 3
core/project_settings.cpp

@@ -884,11 +884,11 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
 		custom_features += f;
 		custom_features += f;
 	}
 	}
 
 
-	if (p_path.ends_with(".godot"))
+	if (p_path.ends_with(".godot") || p_path.ends_with("override.cfg")) {
 		return _save_settings_text(p_path, props, p_custom, custom_features);
 		return _save_settings_text(p_path, props, p_custom, custom_features);
-	else if (p_path.ends_with(".binary"))
+	} else if (p_path.ends_with(".binary")) {
 		return _save_settings_binary(p_path, props, p_custom, custom_features);
 		return _save_settings_binary(p_path, props, p_custom, custom_features);
-	else {
+	} else {
 
 
 		ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Unknown config file format: " + p_path + ".");
 		ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Unknown config file format: " + p_path + ".");
 	}
 	}

+ 2 - 1
doc/classes/ProjectSettings.xml

@@ -149,6 +149,7 @@
 			</return>
 			</return>
 			<description>
 			<description>
 				Saves the configuration to the [code]project.godot[/code] file.
 				Saves the configuration to the [code]project.godot[/code] file.
+				[b]Note:[/b] This method is intended to be used by editor plugins, as modified [ProjectSettings] can't be loaded back in the running app. If you want to change project settings in exported projects, use [method save_custom] to save [code]override.cfg[/code] file.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="save_custom">
 		<method name="save_custom">
@@ -157,7 +158,7 @@
 			<argument index="0" name="file" type="String">
 			<argument index="0" name="file" type="String">
 			</argument>
 			</argument>
 			<description>
 			<description>
-				Saves the configuration to a custom file. The file extension must be [code].godot[/code] (to save in text-based [ConfigFile] format) or [code].binary[/code] (to save in binary format).
+				Saves the configuration to a custom file. The file extension must be [code].godot[/code] (to save in text-based [ConfigFile] format) or [code].binary[/code] (to save in binary format). You can also save [code]override.cfg[/code] file, which is also text, but can be used in exported projects unlike other formats.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="set_initial_value">
 		<method name="set_initial_value">