aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations/IO/ManagedFileSystem.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Common.Implementations/IO/ManagedFileSystem.cs')
-rw-r--r--Emby.Common.Implementations/IO/ManagedFileSystem.cs56
1 files changed, 37 insertions, 19 deletions
diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
index ba73c1ba2..3ed4f650f 100644
--- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
@@ -546,24 +546,6 @@ namespace Emby.Common.Implementations.IO
return Path.DirectorySeparatorChar;
}
- public bool AreEqual(string path1, string path2)
- {
- if (path1 == null && path2 == null)
- {
- return true;
- }
-
- if (path1 == null || path2 == null)
- {
- return false;
- }
-
- path1 = path1.TrimEnd(GetDirectorySeparatorChar(path1));
- path2 = path2.TrimEnd(GetDirectorySeparatorChar(path2));
-
- return string.Equals(path1, path2, StringComparison.OrdinalIgnoreCase);
- }
-
public bool ContainsSubPath(string parentPath, string path)
{
if (string.IsNullOrEmpty(parentPath))
@@ -588,7 +570,7 @@ namespace Emby.Common.Implementations.IO
throw new ArgumentNullException("path");
}
- var parent = Path.GetDirectoryName(path);
+ var parent = GetDirectoryName(path);
if (!string.IsNullOrEmpty(parent))
{
@@ -598,6 +580,16 @@ namespace Emby.Common.Implementations.IO
return true;
}
+ public string GetDirectoryName(string path)
+ {
+ if (_sharpCifsFileSystem.IsEnabledForPath(path))
+ {
+ return _sharpCifsFileSystem.GetDirectoryName(path);
+ }
+
+ return Path.GetDirectoryName(path);
+ }
+
public string NormalizePath(string path)
{
if (string.IsNullOrEmpty(path))
@@ -605,6 +597,11 @@ namespace Emby.Common.Implementations.IO
throw new ArgumentNullException("path");
}
+ if (_sharpCifsFileSystem.IsEnabledForPath(path))
+ {
+ return _sharpCifsFileSystem.NormalizePath(path);
+ }
+
if (path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase))
{
return path;
@@ -613,6 +610,21 @@ namespace Emby.Common.Implementations.IO
return path.TrimEnd(GetDirectorySeparatorChar(path));
}
+ public bool AreEqual(string path1, string path2)
+ {
+ if (path1 == null && path2 == null)
+ {
+ return true;
+ }
+
+ if (path1 == null || path2 == null)
+ {
+ return false;
+ }
+
+ return string.Equals(NormalizePath(path1), NormalizePath(path2), StringComparison.OrdinalIgnoreCase);
+ }
+
public string GetFileNameWithoutExtension(FileSystemMetadata info)
{
if (info.IsDirectory)
@@ -637,11 +649,17 @@ namespace Emby.Common.Implementations.IO
// Cannot use Path.IsPathRooted because it returns false under mono when using windows-based paths, e.g. C:\\
+ if (_sharpCifsFileSystem.IsEnabledForPath(path))
+ {
+ return true;
+ }
+
if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) != -1 &&
!path.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
{
return false;
}
+
return true;
//return Path.IsPathRooted(path);