1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00
Radarr/NzbDrone.Test.Common/StringExtensions.cs

23 lines
600 B
C#
Raw Normal View History

2013-07-26 07:00:57 +02:00
using System.IO;
using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Test.Common
{
public static class StringExtensions
{
public static string AsOsAgnostic(this string path)
{
if (OsInfo.IsLinux)
{
if (path.Length > 2 && path[1] == ':')
{
2013-07-26 07:55:19 +02:00
path = path.Replace(":", "");
path = Path.DirectorySeparatorChar + path;
2013-07-26 07:00:57 +02:00
}
path = path.Replace("\\", Path.DirectorySeparatorChar.ToString());
}
return path;
}
}
}