You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/Recyclarr.TestLibrary/FileUtils.cs

21 lines
557 B

using System.IO.Abstractions.TestingHelpers;
using System.Text.RegularExpressions;
namespace Recyclarr.TestLibrary;
public static class FileUtils
{
public static ICollection<string> NormalizePaths(IEnumerable<string> paths)
=> paths.Select(NormalizePath).ToList();
public static string NormalizePath(string path)
{
if (MockUnixSupport.IsUnixPlatform())
{
return Regex.Replace(path, @"^C:\\", "/").Replace("\\", "/");
}
return Regex.Replace(path, @"^/", @"C:\").Replace("/", "\\");
}
}