2013-07-26 05:00:57 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Test.Common
|
|
|
|
|
{
|
|
|
|
|
public static class StringExtensions
|
|
|
|
|
{
|
|
|
|
|
public static string AsOsAgnostic(this string path)
|
|
|
|
|
{
|
2014-12-07 20:54:07 +00:00
|
|
|
|
if (OsInfo.IsNotWindows)
|
2013-07-26 05:00:57 +00:00
|
|
|
|
{
|
|
|
|
|
if (path.Length > 2 && path[1] == ':')
|
|
|
|
|
{
|
2013-07-26 05:55:19 +00:00
|
|
|
|
path = path.Replace(":", "");
|
|
|
|
|
path = Path.DirectorySeparatorChar + path;
|
2013-07-26 05:00:57 +00:00
|
|
|
|
}
|
2021-08-03 04:43:28 +00:00
|
|
|
|
|
2013-07-26 05:00:57 +00:00
|
|
|
|
path = path.Replace("\\", Path.DirectorySeparatorChar.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-03 04:43:28 +00:00
|
|
|
|
}
|