diff --git a/Assets/Cryville/Common/StringUtils.cs b/Assets/Cryville/Common/StringUtils.cs index b230bc8..cbff5fe 100644 --- a/Assets/Cryville/Common/StringUtils.cs +++ b/Assets/Cryville/Common/StringUtils.cs @@ -40,7 +40,9 @@ namespace Cryville.Common { /// The file name excluding the extension. /// The escaped file name. public static string EscapeFileName(string name) { - return Regex.Replace(name, @"[\/\\\<\>\:\x22\|\?\*\p{Cc}\.\s]", "_"); + var result = Regex.Replace(name, @"[\/\\\<\>\:\x22\|\?\*\p{Cc}]", "_").TrimEnd(' ', '.'); + if (result.Length == 0) return "_"; + return result; } } }