|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace DiscordChatExporter.Core.Utils;
|
|
|
|
@ -8,7 +8,7 @@ namespace DiscordChatExporter.Core.Utils;
|
|
|
|
|
public static class PathEx
|
|
|
|
|
{
|
|
|
|
|
private static readonly HashSet<char> InvalidFileNameChars =
|
|
|
|
|
new(Path.GetInvalidFileNameChars());
|
|
|
|
|
[..Path.GetInvalidFileNameChars()];
|
|
|
|
|
|
|
|
|
|
public static string EscapeFileName(string path)
|
|
|
|
|
{
|
|
|
|
@ -19,7 +19,7 @@ public static class PathEx
|
|
|
|
|
|
|
|
|
|
// File names cannot end with a dot on Windows
|
|
|
|
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/977
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
|
|
if (OperatingSystem.IsWindows())
|
|
|
|
|
{
|
|
|
|
|
while (buffer.Length > 0 && buffer[^1] == '.')
|
|
|
|
|
buffer.Remove(buffer.Length - 1, 1);
|
|
|
|
|