diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-11-26 19:00:53 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-11-26 19:02:32 +0100 |
commit | af9c67db0c998bbd6f0de1ab0af98f9e615e6029 (patch) | |
tree | 018b3b3f6044e5c02cbaa1b44e01495e0013361c /platform/windows/os_windows.cpp | |
parent | 9cf44c1c53f03b67143e606ab3d56680d73ac2c9 (diff) |
Allow customizing user:// path (folder in OS::get_data_path())
This allows to specify any valid folder name (including with subfolders) to use
as user:// on all platforms. The folder is constrained to the platform-specific
OS::get_data_path() (typically what `XDG_DATA_HOME` resolves to).
Fixes #13236.
Diffstat (limited to 'platform/windows/os_windows.cpp')
-rw-r--r-- | platform/windows/os_windows.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 827189bb4f..284dfaf904 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2199,14 +2199,17 @@ String OS_Windows::get_system_dir(SystemDir p_dir) const { String OS_Windows::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).replace("\\", "/"); + 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).replace("\\", "/"); } else { - return get_data_path().plus_file(appname).replace("\\", "/"); + return get_data_path().plus_file(get_godot_dir_name()).plus_file("app_userdata").plus_file(appname).replace("\\", "/"); } } |