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
This commit is contained in:
parent
336f69b214
commit
c0e7155591
|
@ -165,22 +165,32 @@ void EditorSettings::create() {
|
||||||
return; //pointless
|
return; //pointless
|
||||||
|
|
||||||
DirAccess *dir=NULL;
|
DirAccess *dir=NULL;
|
||||||
Object *object;
|
|
||||||
Variant meta;
|
Variant meta;
|
||||||
|
|
||||||
String config_path;
|
String config_path;
|
||||||
String config_dir;
|
String config_dir;
|
||||||
String config_file="editor_settings.xml";
|
String config_file="editor_settings.xml";
|
||||||
|
|
||||||
if (OS::get_singleton()->has_environment("APPDATA")) {
|
String exe_path = OS::get_singleton()->get_executable_path().get_base_dir();
|
||||||
// Most likely under windows, save here
|
DirAccess* d = DirAccess::create_for_path(exe_path);
|
||||||
config_path=OS::get_singleton()->get_environment("APPDATA");
|
if (d->file_exists(exe_path + "/._sc_")) {
|
||||||
config_dir=String(_MKSTR(VERSION_SHORT_NAME)).capitalize();
|
|
||||||
} else if (OS::get_singleton()->has_environment("HOME")) {
|
|
||||||
|
|
||||||
config_path=OS::get_singleton()->get_environment("HOME");
|
// editor is self contained
|
||||||
config_dir="."+String(_MKSTR(VERSION_SHORT_NAME)).to_lower();
|
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
|
ObjectTypeDB::register_type<EditorSettings>(); //otherwise it can't be unserialized
|
||||||
String config_file_path;
|
String config_file_path;
|
||||||
|
|
Loading…
Reference in New Issue