mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Moved duplicated NormalizePath method to PathExtentions
This commit is contained in:
parent
95d1832379
commit
6778a6ed99
9 changed files with 54 additions and 60 deletions
|
@ -1,4 +1,5 @@
|
|||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace NzbDrone.Common
|
||||
{
|
||||
|
@ -22,6 +23,22 @@ namespace NzbDrone.Common
|
|||
private const string UPDATE_CLIENT_EXE = "nzbdrone.update.exe";
|
||||
private const string UPDATE_CLIENT_FOLDER_NAME = "NzbDrone.Update\\";
|
||||
|
||||
public static string NormalizePath(this string path)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(path))
|
||||
throw new ArgumentException("Path can not be null or empty");
|
||||
|
||||
var info = new FileInfo(path);
|
||||
|
||||
if (info.FullName.StartsWith(@"\\")) //UNC
|
||||
{
|
||||
return info.FullName.TrimEnd('/', '\\', ' ');
|
||||
}
|
||||
|
||||
return info.FullName.Trim('/', '\\', ' ');
|
||||
}
|
||||
|
||||
|
||||
public static string GetIISFolder(this EnviromentProvider enviromentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.ApplicationPath, IIS_FOLDER);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue