mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 17:44:43 +01:00
Merge pull request #5890 from Bond-009/filesystem
Reduce string allocations/fs lookups in resolve code
This commit is contained in:
@@ -120,8 +120,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService)
|
||||
{
|
||||
FileInfo = FileSystem.GetDirectoryInfo(path),
|
||||
Path = path
|
||||
FileInfo = FileSystem.GetDirectoryInfo(path)
|
||||
};
|
||||
|
||||
// Gather child folder and files
|
||||
|
||||
@@ -271,7 +271,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService)
|
||||
{
|
||||
FileInfo = FileSystem.GetDirectoryInfo(path),
|
||||
Path = path,
|
||||
Parent = GetParent() as Folder,
|
||||
CollectionType = CollectionType
|
||||
};
|
||||
|
||||
@@ -60,10 +60,10 @@ namespace MediaBrowser.Controller.Library
|
||||
public FileSystemMetadata FileInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
/// Gets the path.
|
||||
/// </summary>
|
||||
/// <value>The path.</value>
|
||||
public string Path { get; set; }
|
||||
public string Path => FileInfo.FullName;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is directory.
|
||||
@@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.Library
|
||||
return false;
|
||||
}
|
||||
|
||||
var parentDir = System.IO.Path.GetDirectoryName(Path) ?? string.Empty;
|
||||
var parentDir = FileInfo.DirectoryName ?? string.Empty;
|
||||
|
||||
return parentDir.Length > _appPaths.RootFolderPath.Length
|
||||
&& parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
Reference in New Issue
Block a user