summaryrefslogtreecommitdiff
path: root/tools/editor/editor_settings.cpp
diff options
context:
space:
mode:
authorAriel Manzur <ariel@okamstudio.com>2016-02-21 20:15:47 -0300
committerAriel Manzur <ariel@okamstudio.com>2016-02-21 20:17:08 -0300
commit9c939d389e3172fefbbb00fc583d85ce630af9ca (patch)
tree107bd335a538208990167515dafc240009f59c21 /tools/editor/editor_settings.cpp
parent499308e48265bea0cf92570c3e3b36dadf7c71d2 (diff)
._sc_ file is now a ConfigFile for self contained mode
can contain a pre-loaded list of projects to be added to editor_settings.xml
Diffstat (limited to 'tools/editor/editor_settings.cpp')
-rw-r--r--tools/editor/editor_settings.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 1298e447d5..78fde9950d 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -170,6 +170,7 @@ void EditorSettings::create() {
String config_path;
String config_dir;
String config_file="editor_settings.xml";
+ Ref<ConfigFile> extra_config = memnew(ConfigFile);
String exe_path = OS::get_singleton()->get_executable_path().get_base_dir();
DirAccess* d = DirAccess::create_for_path(exe_path);
@@ -178,7 +179,7 @@ void EditorSettings::create() {
// 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")) {
@@ -296,10 +297,20 @@ void EditorSettings::create() {
fail:
+ // patch init projects
+ if (extra_config->has_section("init_projects")) {
+ Vector<String> list = extra_config->get_value("init_projects", "list");
+ for (int i=0; i<list.size(); i++) {
+
+ list[i] = exe_path + "/" + list[i];
+ };
+ extra_config->set_value("init_projects", "list", list);
+ };
+
singleton = Ref<EditorSettings>( memnew( EditorSettings ) );
singleton->config_file_path=config_file_path;
singleton->settings_path=config_path+"/"+config_dir;
- singleton->_load_defaults();
+ singleton->_load_defaults(extra_config);
singleton->setup_network();
singleton->scan_plugins();
@@ -445,7 +456,7 @@ void EditorSettings::destroy() {
singleton=Ref<EditorSettings>();
}
-void EditorSettings::_load_defaults() {
+void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_THREAD_SAFE_METHOD_
@@ -552,6 +563,17 @@ void EditorSettings::_load_defaults() {
set("run/auto_save_before_running",true);
set("resources/save_compressed_resources",true);
set("resources/auto_reload_modified_images",true);
+
+ if (p_extra_config.is_valid() && p_extra_config->has_section("init_projects") && p_extra_config->has_section_key("init_projects", "list")) {
+
+ Vector<String> list = p_extra_config->get_value("init_projects", "list");
+ for (int i=0; i<list.size(); i++) {
+
+ String name = list[i].replace("/", "::");
+ set("projects/"+name, list[i]);
+ };
+ };
+
}
void EditorSettings::notify_changes() {