From 71f164ca388efe640c378a9f0e14b374fc789c52 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 27 Sep 2022 09:40:22 -0500 Subject: refactor listing --- src/slskd/Shares/ShareService.cs | 7 ++++--- src/slskd/Shares/SharedFileCache.cs | 18 ------------------ 2 files changed, 4 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs index e99d048a..4505ea3e 100644 --- a/src/slskd/Shares/ShareService.cs +++ b/src/slskd/Shares/ShareService.cs @@ -150,10 +150,11 @@ namespace slskd.Shares /// The contents of the directory. public Task ListDirectoryAsync(string directory) { - var list = Cache.List(directory.LocalizePath()); - var normalizedList = new Directory(list.Name.NormalizePathForSoulseek(), list.Files); + var localPath = directory.LocalizePath(); - return Task.FromResult(normalizedList); + var files = Repository.ListFiles(localPath); + + return Task.FromResult(new Directory(directory, files)); } /// diff --git a/src/slskd/Shares/SharedFileCache.cs b/src/slskd/Shares/SharedFileCache.cs index 190679a8..6e6cc6e6 100644 --- a/src/slskd/Shares/SharedFileCache.cs +++ b/src/slskd/Shares/SharedFileCache.cs @@ -50,13 +50,6 @@ namespace slskd.Shares /// The operation context. Task FillAsync(IEnumerable shares, IEnumerable filters); - /// - /// Returns the contents of the specified . - /// - /// The directory for which the contents are to be listed. - /// The contents of the directory. - Directory List(string directory); - /// /// Substitutes the mask in the specified with the original path, if the mask is tracked /// by the cache. @@ -379,17 +372,6 @@ namespace slskd.Shares } } - /// - /// Returns the contents of the specified . - /// - /// The directory for which the contents are to be listed. - /// The contents of the directory. - public Directory List(string directory) - { - var files = Repository.ListFiles(directory); - return new Directory(directory, files); - } - /// /// Substitutes the mask in the specified with the original path, if the mask is tracked /// by the cache. -- cgit v1.2.3