diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Shares/IShareService.cs | 7 | ||||
| -rw-r--r-- | src/slskd/Shares/ShareService.cs | 19 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/slskd/Shares/IShareService.cs b/src/slskd/Shares/IShareService.cs index 2a18f5b3..f8e2076d 100644 --- a/src/slskd/Shares/IShareService.cs +++ b/src/slskd/Shares/IShareService.cs @@ -60,7 +60,12 @@ namespace slskd.Shares /// <exception cref="NotFoundException"> /// Thrown when the specified remote filename can not be associated with a configured share. /// </exception> - Task<FileInfo> ResolveFileAsync(string remoteFilename); + Task<string> ResolveFileAsync(string remoteFilename); + + /// <summary> + /// Requests that a share scan is performed. + /// </summary> + void RequestScan(); /// <summary> /// Searches the cache for the specified <paramref name="query"/> and returns the matching files. diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs index 09085b72..2b761965 100644 --- a/src/slskd/Shares/ShareService.cs +++ b/src/slskd/Shares/ShareService.cs @@ -173,7 +173,7 @@ namespace slskd.Shares /// <exception cref="NotFoundException"> /// Thrown when the specified remote filename can not be associated with a configured share. /// </exception> - public Task<FileInfo> ResolveFileAsync(string remoteFilename) + public Task<string> ResolveFileAsync(string remoteFilename) { var resolvedFilename = Repository.FindFilename(remoteFilename.LocalizePath()); @@ -182,16 +182,15 @@ namespace slskd.Shares throw new NotFoundException($"The requested filename '{remoteFilename}' could not be resolved to a local file"); } - var fileInfo = new FileInfo(resolvedFilename); - - if (!fileInfo.Exists) - { - // the shared file cache has divered from the physical filesystem; the user needs to perform a scan to reconcile. - State.SetValue(state => state with { ScanPending = true }); - throw new NotFoundException($"The resolved file '{resolvedFilename}' could not be located on disk. A share scan should be performed."); - } + return Task.FromResult(resolvedFilename); + } - return Task.FromResult(fileInfo); + /// <summary> + /// Requests that a share scan is performed. + /// </summary> + public void RequestScan() + { + State.SetValue(state => state with { ScanPending = true }); } /// <summary> |
