1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

Save and restore debug options

This commit is contained in:
volzhs
2017-02-08 14:18:48 +09:00
parent 6bfaa0f12c
commit 79e8616fbb
5 changed files with 38 additions and 14 deletions

View File

@@ -1029,26 +1029,22 @@ void EditorSettings::set_optimize_save(bool p_optimize) {
optimize_save=p_optimize;
}
String EditorSettings::get_last_selected_language()
{
Variant EditorSettings::get_project_metadata(const String& p_section, const String& p_key, Variant p_default) {
Ref<ConfigFile> cf = memnew( ConfigFile );
String path = get_project_settings_path().plus_file("project_metadata.cfg");
Error err = cf->load(path);
if (err != OK) {
return "";
return p_default;
}
Variant last_selected_language = cf->get_value("script_setup", "last_selected_language");
if (last_selected_language.get_type() != Variant::STRING)
return "";
return static_cast<String>(last_selected_language);
return cf->get_value(p_section, p_key, p_default);
}
void EditorSettings::set_last_selected_language(String p_language)
void EditorSettings::set_project_metadata(const String& p_section, const String& p_key, Variant p_data)
{
Ref<ConfigFile> cf = memnew( ConfigFile );
String path = get_project_settings_path().plus_file("project_metadata.cfg");
cf->load(path);
cf->set_value("script_setup", "last_selected_language", p_language);
cf->set_value(p_section, p_key, p_data);
cf->save(path);
}