summaryrefslogtreecommitdiffstats
path: root/core/os/os.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/os/os.cpp')
-rw-r--r--core/os/os.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 40d8601af3..642de11a9f 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -247,7 +247,10 @@ String OS::get_safe_dir_name(const String &p_dir_name, bool p_allow_paths) const
for (int i = 0; i < invalid_chars.size(); i++) {
safe_dir_name = safe_dir_name.replace(invalid_chars[i], "-");
}
- return safe_dir_name;
+
+ // Trim trailing periods from the returned value as it's not valid for folder names on Windows.
+ // This check is still applied on non-Windows platforms so the returned value is consistent across platforms.
+ return safe_dir_name.rstrip(".");
}
// Path to data, config, cache, etc. OS-specific folders