This commit is contained in:
Luke Pulverenti 2017-04-02 00:45:57 -04:00
parent 6e4d234212
commit 4a8960fc86
3 changed files with 19 additions and 9 deletions

View File

@ -536,14 +536,14 @@ namespace Emby.Common.Implementations.IO
CopyFile(temp1, file2, true);
}
private char GetSeparatorChar(string path)
private char GetDirectorySeparatorChar(string path)
{
if (path.IndexOf('/') != -1)
if (_sharpCifsFileSystem.IsEnabledForPath(path))
{
return '/';
return _sharpCifsFileSystem.GetDirectorySeparatorChar(path);
}
return '\\';
return Path.DirectorySeparatorChar;
}
public bool AreEqual(string path1, string path2)
@ -558,8 +558,8 @@ namespace Emby.Common.Implementations.IO
return false;
}
path1 = path1.TrimEnd(GetSeparatorChar(path1));
path2 = path2.TrimEnd(GetSeparatorChar(path2));
path1 = path1.TrimEnd(GetDirectorySeparatorChar(path1));
path2 = path2.TrimEnd(GetDirectorySeparatorChar(path2));
return string.Equals(path1, path2, StringComparison.OrdinalIgnoreCase);
}
@ -576,7 +576,7 @@ namespace Emby.Common.Implementations.IO
throw new ArgumentNullException("path");
}
var separatorChar = GetSeparatorChar(parentPath);
var separatorChar = GetDirectorySeparatorChar(parentPath);
return path.IndexOf(parentPath.TrimEnd(separatorChar) + separatorChar, StringComparison.OrdinalIgnoreCase) != -1;
}
@ -610,7 +610,7 @@ namespace Emby.Common.Implementations.IO
return path;
}
return path.TrimEnd(GetSeparatorChar(path));
return path.TrimEnd(GetDirectorySeparatorChar(path));
}
public string GetFileNameWithoutExtension(FileSystemMetadata info)

View File

@ -30,6 +30,16 @@ namespace Emby.Common.Implementations.IO
return path.StartsWith("smb://", StringComparison.OrdinalIgnoreCase) || IsUncPath(path);
}
public char GetDirectorySeparatorChar(string path)
{
if (path.IndexOf('/') != -1)
{
return '/';
}
return '\\';
}
public FileSystemMetadata GetFileSystemInfo(string path)
{
var file = CreateSmbFile(path);

View File

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.10.3")]
[assembly: AssemblyVersion("3.2.10.4")]