1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 10:32:35 +01:00
Radarr/src/NzbDrone.Test.Common/StringExtensions.cs
2014-12-07 12:56:47 -08:00

23 lines
605 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;
}
}
}