mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-16 07:06:18 +00:00
Minor LibraryMonitor improvements
* Enable nullable * Add a fast return to ReportFileSystemChanged when path should be ignored * Use Span overloads of Path.* functions where possible * IFileSystem: remove NormalizePath as Path.TrimEndingDirectorySeparator already checks if it's a root path
This commit is contained in:
@@ -8,24 +8,17 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
public class MbLinkShortcutHandler : IShortcutHandler
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public MbLinkShortcutHandler(IFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public string Extension => ".mblink";
|
||||
|
||||
public string? Resolve(string shortcutPath)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(shortcutPath);
|
||||
|
||||
if (string.Equals(Path.GetExtension(shortcutPath), ".mblink", StringComparison.OrdinalIgnoreCase))
|
||||
if (Path.GetExtension(shortcutPath.AsSpan()).Equals(".mblink", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var path = File.ReadAllText(shortcutPath);
|
||||
|
||||
return _fileSystem.NormalizePath(path);
|
||||
return Path.TrimEndingDirectorySeparator(path);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user