aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations/IO/ManagedFileSystem.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-04-02 00:08:07 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-04-02 00:08:07 -0400
commit6e4d2342120c4bde4fdc99bc17dea0aec7b75ced (patch)
treecbbb88f9cfcb1924020dcc8f6f92aa438e8a6248 /Emby.Common.Implementations/IO/ManagedFileSystem.cs
parent733b891f529c2458d65560f556edf68052be2846 (diff)
update directory picker
Diffstat (limited to 'Emby.Common.Implementations/IO/ManagedFileSystem.cs')
-rw-r--r--Emby.Common.Implementations/IO/ManagedFileSystem.cs28
1 files changed, 16 insertions, 12 deletions
diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
index f1f044bc5..d1903851f 100644
--- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
@@ -69,14 +69,6 @@ namespace Emby.Common.Implementations.IO
}
}
- public char PathSeparator
- {
- get
- {
- return Path.PathSeparator;
- }
- }
-
public string GetFullPath(string path)
{
return Path.GetFullPath(path);
@@ -544,6 +536,16 @@ namespace Emby.Common.Implementations.IO
CopyFile(temp1, file2, true);
}
+ private char GetSeparatorChar(string path)
+ {
+ if (path.IndexOf('/') != -1)
+ {
+ return '/';
+ }
+
+ return '\\';
+ }
+
public bool AreEqual(string path1, string path2)
{
if (path1 == null && path2 == null)
@@ -556,8 +558,8 @@ namespace Emby.Common.Implementations.IO
return false;
}
- path1 = path1.TrimEnd(DirectorySeparatorChar);
- path2 = path2.TrimEnd(DirectorySeparatorChar);
+ path1 = path1.TrimEnd(GetSeparatorChar(path1));
+ path2 = path2.TrimEnd(GetSeparatorChar(path2));
return string.Equals(path1, path2, StringComparison.OrdinalIgnoreCase);
}
@@ -574,7 +576,9 @@ namespace Emby.Common.Implementations.IO
throw new ArgumentNullException("path");
}
- return path.IndexOf(parentPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) != -1;
+ var separatorChar = GetSeparatorChar(parentPath);
+
+ return path.IndexOf(parentPath.TrimEnd(separatorChar) + separatorChar, StringComparison.OrdinalIgnoreCase) != -1;
}
public bool IsRootPath(string path)
@@ -606,7 +610,7 @@ namespace Emby.Common.Implementations.IO
return path;
}
- return path.TrimEnd(Path.DirectorySeparatorChar);
+ return path.TrimEnd(GetSeparatorChar(path));
}
public string GetFileNameWithoutExtension(FileSystemMetadata info)