Remove ManagedFileSystem.IsRootPath

`Path.IsPathRooted` should be used instead
pull/5676/head
Bond_009 4 years ago
parent aa76957338
commit c533b20496

@ -55,7 +55,7 @@ namespace Emby.Server.Implementations.IO
}
var extension = Path.GetExtension(filename);
return _shortcutHandlers.Any(i => string.Equals(extension, i.Extension, StringComparison.OrdinalIgnoreCase));
return _shortcutHandlers.Any(i => string.Equals(extension, i.Extension, _isEnvironmentCaseInsensitive ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal));
}
/// <summary>
@ -487,26 +487,9 @@ namespace Emby.Server.Implementations.IO
throw new ArgumentNullException(nameof(path));
}
var separatorChar = Path.DirectorySeparatorChar;
return path.IndexOf(parentPath.TrimEnd(separatorChar) + separatorChar, StringComparison.OrdinalIgnoreCase) != -1;
}
public virtual bool IsRootPath(string path)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException(nameof(path));
}
var parent = Path.GetDirectoryName(path);
if (!string.IsNullOrEmpty(parent))
{
return false;
}
return true;
return path.Contains(
Path.TrimEndingDirectorySeparator(parentPath) + Path.DirectorySeparatorChar,
_isEnvironmentCaseInsensitive ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
}
public virtual string NormalizePath(string path)
@ -521,7 +504,7 @@ namespace Emby.Server.Implementations.IO
return path;
}
return path.TrimEnd(Path.DirectorySeparatorChar);
return Path.TrimEndingDirectorySeparator(path);
}
public virtual bool AreEqual(string path1, string path2)
@ -536,7 +519,10 @@ namespace Emby.Server.Implementations.IO
return false;
}
return string.Equals(NormalizePath(path1), NormalizePath(path2), StringComparison.OrdinalIgnoreCase);
return string.Equals(
NormalizePath(path1),
NormalizePath(path2),
_isEnvironmentCaseInsensitive ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
}
public virtual string GetFileNameWithoutExtension(FileSystemMetadata info)

@ -117,13 +117,6 @@ namespace MediaBrowser.Model.IO
/// <returns><c>true</c> if [contains sub path] [the specified parent path]; otherwise, <c>false</c>.</returns>
bool ContainsSubPath(string parentPath, string path);
/// <summary>
/// Determines whether [is root path] [the specified path].
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if [is root path] [the specified path]; otherwise, <c>false</c>.</returns>
bool IsRootPath(string path);
/// <summary>
/// Normalizes the path.
/// </summary>

Loading…
Cancel
Save