diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-11-26 22:25:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-26 22:25:02 +0100 |
commit | 90f9f123fd4a79440d21557d4f56ef35be318fad (patch) | |
tree | 9032870c3a2e7f470401580203e6c7727aa6eb4b /drivers | |
parent | 4a1d1cbbb4e462a016d87acb316b5ae12984fe81 (diff) | |
parent | af9c67db0c998bbd6f0de1ab0af98f9e615e6029 (diff) |
Merge pull request #13317 from akien-mga/custom_user_dir
Allow customizing user:// path (folder in OS::get_data_path())
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/unix/os_unix.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 0d102902e8..0b1aebaaab 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -447,13 +447,17 @@ int OS_Unix::get_processor_count() const { String OS_Unix::get_user_data_dir() const { - String appname = get_safe_application_name(); + String appname = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/name")); if (appname != "") { - bool use_godot_dir = ProjectSettings::get_singleton()->get("application/config/use_shared_user_dir"); - if (use_godot_dir) { - return get_data_path().plus_file(get_godot_dir_name()).plus_file("app_userdata").plus_file(appname); + bool use_custom_dir = ProjectSettings::get_singleton()->get("application/config/use_custom_user_dir"); + if (use_custom_dir) { + String custom_dir = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/custom_user_dir_name"), true); + if (custom_dir == "") { + custom_dir = appname; + } + return get_data_path().plus_file(custom_dir); } else { - return get_data_path().plus_file(appname); + return get_data_path().plus_file(get_godot_dir_name()).plus_file("app_userdata").plus_file(appname); } } |