summaryrefslogtreecommitdiff
path: root/tools/editor/editor_settings.cpp
diff options
context:
space:
mode:
authorAriel Manzur <ariel@okamstudio.com>2016-02-19 04:41:08 -0300
committerAriel Manzur <ariel@okamstudio.com>2016-02-19 04:43:35 -0300
commitc0e7155591184dffe2d292a0b17d19cb852ae6b2 (patch)
treef08a7f3fc72aa0897dc877a0ed777c159505982b /tools/editor/editor_settings.cpp
parent336f69b2144e978dcc98e2a0b4dd00022e46a43b (diff)
Added "self contained" mode for Steam installation and similar. Editor looks for a file ._sc_ in the directory where the executable is, if it's present, all the editor settings (including the export templates) are read from editor_data/ inside that directory
Diffstat (limited to 'tools/editor/editor_settings.cpp')
-rw-r--r--tools/editor/editor_settings.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index e8b40bdcf3..1298e447d5 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -165,22 +165,32 @@ void EditorSettings::create() {
return; //pointless
DirAccess *dir=NULL;
- Object *object;
Variant meta;
String config_path;
String config_dir;
String config_file="editor_settings.xml";
- if (OS::get_singleton()->has_environment("APPDATA")) {
- // Most likely under windows, save here
- config_path=OS::get_singleton()->get_environment("APPDATA");
- config_dir=String(_MKSTR(VERSION_SHORT_NAME)).capitalize();
- } else if (OS::get_singleton()->has_environment("HOME")) {
+ String exe_path = OS::get_singleton()->get_executable_path().get_base_dir();
+ DirAccess* d = DirAccess::create_for_path(exe_path);
+ if (d->file_exists(exe_path + "/._sc_")) {
- config_path=OS::get_singleton()->get_environment("HOME");
- config_dir="."+String(_MKSTR(VERSION_SHORT_NAME)).to_lower();
- }
+ // editor is self contained
+ config_path = exe_path;
+ config_dir = "editor_data";
+
+ } else {
+
+ if (OS::get_singleton()->has_environment("APPDATA")) {
+ // Most likely under windows, save here
+ config_path=OS::get_singleton()->get_environment("APPDATA");
+ config_dir=String(_MKSTR(VERSION_SHORT_NAME)).capitalize();
+ } else if (OS::get_singleton()->has_environment("HOME")) {
+
+ config_path=OS::get_singleton()->get_environment("HOME");
+ config_dir="."+String(_MKSTR(VERSION_SHORT_NAME)).to_lower();
+ }
+ };
ObjectTypeDB::register_type<EditorSettings>(); //otherwise it can't be unserialized
String config_file_path;