diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2017-10-17 11:36:19 +0200 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2017-10-17 11:36:19 +0200 |
commit | 1bafd0e33a7510c32ba897f5821ca2c10b3388e0 (patch) | |
tree | 95efe5c723b7615ef822c9609fda630cf47f703b /modules/mono | |
parent | 1b2e09355e890ae32fe172aad19dcda137ed636f (diff) |
Take self-contained mode into consideration
Diffstat (limited to 'modules/mono')
-rw-r--r-- | modules/mono/godotsharp_dirs.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp index 0a2010e99d..6bcf0e2355 100644 --- a/modules/mono/godotsharp_dirs.cpp +++ b/modules/mono/godotsharp_dirs.cpp @@ -33,6 +33,7 @@ #ifdef TOOLS_ENABLED #include "editor/editor_settings.h" +#include "os/dir_access.h" #include "project_settings.h" #include "version.h" #endif @@ -60,12 +61,20 @@ String _get_mono_user_dir() { } else { String settings_path; - if (OS::get_singleton()->has_environment("APPDATA")) { - String app_data = OS::get_singleton()->get_environment("APPDATA").replace("\\", "/"); - settings_path = app_data.plus_file(String(_MKSTR(VERSION_SHORT_NAME)).capitalize()); - } else if (OS::get_singleton()->has_environment("HOME")) { - String home = OS::get_singleton()->get_environment("HOME"); - settings_path = home.plus_file("." + String(_MKSTR(VERSION_SHORT_NAME)).to_lower()); + String exe_dir = OS::get_singleton()->get_executable_path().get_base_dir(); + DirAccessRef d = DirAccess::create_for_path(exe_dir); + + if (d->file_exists("._sc_") || d->file_exists("_sc_")) { + // contain yourself + settings_path = exe_dir.plus_file("editor_data"); + } else { + if (OS::get_singleton()->has_environment("APPDATA")) { + String app_data = OS::get_singleton()->get_environment("APPDATA").replace("\\", "/"); + settings_path = app_data.plus_file(String(_MKSTR(VERSION_SHORT_NAME)).capitalize()); + } else if (OS::get_singleton()->has_environment("HOME")) { + String home = OS::get_singleton()->get_environment("HOME"); + settings_path = home.plus_file("." + String(_MKSTR(VERSION_SHORT_NAME)).to_lower()); + } } return settings_path.plus_file("mono"); |