Skip to content

Commit

Permalink
Use a few new APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Aug 10, 2024
1 parent c978a4c commit 73e2e06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DiscordChatExporter.Core/Exporting/HtmlMessageWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class HtmlMessageWriter(Stream stream, ExportContext context, string th
private readonly TextWriter _writer = new StreamWriter(stream);

private readonly HtmlMinifier _minifier = new();
private readonly List<Message> _messageGroup = new();
private readonly List<Message> _messageGroup = [];

private bool CanJoinGroup(Message message)
{
Expand Down
8 changes: 4 additions & 4 deletions DiscordChatExporter.Core/Utils/PathEx.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;

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)
{
Expand All @@ -19,7 +19,7 @@ public static string EscapeFileName(string path)

// 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);
Expand Down

0 comments on commit 73e2e06

Please sign in to comment.