From f4d3d0ecfca66a7a1f9310d68cc3d4f523713a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Mon, 12 Dec 2022 00:03:30 +0100 Subject: [PATCH 1/2] Move MakeFileSystemFriendly to HL. --- .../Extensions/StringExtensions.cs | 67 ------------------- 1 file changed, 67 deletions(-) delete mode 100644 Lombiq.Tests.UI/Extensions/StringExtensions.cs diff --git a/Lombiq.Tests.UI/Extensions/StringExtensions.cs b/Lombiq.Tests.UI/Extensions/StringExtensions.cs deleted file mode 100644 index 8a8551c01..000000000 --- a/Lombiq.Tests.UI/Extensions/StringExtensions.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.IO; -using System.Linq; - -namespace Lombiq.Tests.UI.Extensions; - -public static class StringExtensions -{ - // The first array contains every invalid character in Windows. This is the union of GetInvalidFileNameChars() and - // GetInvalidPathChars() evaluated on Windows (for FAT and NTFS). Linux file systems aren't as strict, they only - // forbid forward slash ('/') and null character ('\0'). This is a subset of the invalid characters on Windows. So - // to make the paths work across all systems (e.g. when we plan to back up to an NTFS store or use GitHub's - // "actions/upload-artifact" action) we have to carry the banned Windows characters across operating systems. - // GetInvalidFileNameChars() and GetInvalidPathChars() are still included in case they contain more characters on - // untested operating systems. - private static readonly Lazy _invalidPathCharacters = new(() => new[] - { - '\0', - '\u0001', - '\u0002', - '\u0003', - '\u0004', - '\u0005', - '\u0006', - '\a', - '\b', - '\t', - '\n', - '\v', - '\f', - '\r', - '\u000e', - '\u000f', - '\u0010', - '\u0011', - '\u0012', - '\u0013', - '\u0014', - '\u0015', - '\u0016', - '\u0017', - '\u0018', - '\u0019', - '\u001a', - '\u001b', - '\u001c', - '\u001d', - '\u001e', - '\u001f', - '|', - ':', - '"', - '<', - '>', - '*', - '?', - } - .Union(Path.GetInvalidFileNameChars()) - .Union(Path.GetInvalidPathChars()) - .ToArray()); - - public static string MakeFileSystemFriendly(this string text) => - string - .Join("_", text.Split(_invalidPathCharacters.Value)) - .Replace('.', '_') - .Replace(' ', '-'); -} From ab0d6fb941ff06a93ba8d9ad28f368103eaacafd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 16 Dec 2022 14:48:46 +0100 Subject: [PATCH 2/2] unusing --- Lombiq.Tests.UI/Services/UITestExecutor.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Lombiq.Tests.UI/Services/UITestExecutor.cs b/Lombiq.Tests.UI/Services/UITestExecutor.cs index 0eda2f395..caa8bae97 100644 --- a/Lombiq.Tests.UI/Services/UITestExecutor.cs +++ b/Lombiq.Tests.UI/Services/UITestExecutor.cs @@ -1,5 +1,4 @@ using Lombiq.HelpfulLibraries.Common.Utilities; -using Lombiq.Tests.UI.Extensions; using Lombiq.Tests.UI.Helpers; using Lombiq.Tests.UI.Models; using Lombiq.Tests.UI.Services.GitHub;