mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-27 08:23:03 +00:00
18
DiscordChatExporter.Domain/Internal/PathEx.cs
Normal file
18
DiscordChatExporter.Domain/Internal/PathEx.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace DiscordChatExporter.Domain.Internal
|
||||
{
|
||||
internal static class PathEx
|
||||
{
|
||||
public static StringBuilder EscapePath(StringBuilder pathBuffer)
|
||||
{
|
||||
foreach (var invalidChar in Path.GetInvalidFileNameChars())
|
||||
pathBuffer.Replace(invalidChar, '_');
|
||||
|
||||
return pathBuffer;
|
||||
}
|
||||
|
||||
public static string EscapePath(string path) => EscapePath(new StringBuilder(path)).ToString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user