1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-12 11:15:43 +02:00
Sonarr/src/NzbDrone.Test.Common/StringExtensions.cs
2022-08-07 15:24:35 -07:00

25 lines
607 B
C#

using System.IO;
using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Test.Common
{
public static class StringExtensions
{
public static string AsOsAgnostic(this string path)
{
if (OsInfo.IsNotWindows)
{
if (path.Length > 2 && path[1] == ':')
{
path = path.Replace(":", "");
path = Path.DirectorySeparatorChar + path;
}
path = path.Replace("\\", Path.DirectorySeparatorChar.ToString());
}
return path;
}
}
}