sonarr-repo-only/NzbDrone.Test.Common/StringExtensions.cs

24 lines
637 B
C#
Raw Normal View History

2013-07-26 05:00:57 +00:00
using System.IO;
2013-08-01 02:02:36 +00:00
using Newtonsoft.Json.Serialization;
2013-07-26 05:00:57 +00:00
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 05:55:19 +00:00
path = path.Replace(":", "");
path = Path.DirectorySeparatorChar + path;
2013-07-26 05:00:57 +00:00
}
path = path.Replace("\\", Path.DirectorySeparatorChar.ToString());
}
return path;
}
}
}