mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-03 09:09:42 +02:00
Moved duplicated NormalizePath method to PathExtentions
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user