Fix import error due to invalid file name. (Amend)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Cryville.Common {
|
||||
/// <summary>
|
||||
@@ -33,5 +34,13 @@ namespace Cryville.Common {
|
||||
b.Append((timeSpan.TotalSeconds % 60).ToString("00." + new string('0', digits)));
|
||||
return b.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// Escapes special characters in a file name.
|
||||
/// </summary>
|
||||
/// <param name="name">The file name excluding the extension.</param>
|
||||
/// <returns>The escaped file name.</returns>
|
||||
public static string EscapeFileName(string name) {
|
||||
return Regex.Replace(name, @"[\/\\\<\>\:\x22\|\?\*\p{Cc}\.\s]", "_");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user