diff options
Diffstat (limited to 'tools/editor/editor_settings.cpp')
-rw-r--r-- | tools/editor/editor_settings.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 1cdc426541..6d9f1bd979 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -242,13 +242,20 @@ void EditorSettings::create() { String exe_path = OS::get_singleton()->get_executable_path().get_base_dir(); DirAccess* d = DirAccess::create_for_path(exe_path); + bool self_contained = false; if (d->file_exists(exe_path + "/._sc_")) { + self_contained = true; + extra_config->load(exe_path + "/._sc_"); + } else if (d->file_exists(exe_path + "/_sc_")) { + self_contained = true; + extra_config->load(exe_path + "/_sc_"); + } + if (self_contained) { // editor is self contained config_path = exe_path; config_dir = "editor_data"; - extra_config->load(exe_path + "/._sc_"); } else { if (OS::get_singleton()->has_environment("APPDATA")) { @@ -655,6 +662,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("run/auto_save/save_before_running",true); set("run/output/always_clear_output_on_play",true); set("run/output/always_open_output_on_play",true); + set("run/output/always_close_output_on_stop",false); set("filesystem/resources/save_compressed_resources",true); set("filesystem/resources/auto_reload_modified_images",true); @@ -1029,26 +1037,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); } |