From 75d6377548ce946189d86aa9433281132ce58195 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 1 Sep 2024 18:43:31 -0500 Subject: pull out destinationDirectory --- src/slskd/Transfers/Downloads/DownloadService.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index 92ab061f..00d6dbbc 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -319,12 +319,11 @@ namespace slskd.Transfers.Downloads // todo: broadcast to signalr hub SynchronizedUpdate(transfer, cancellable: false); - // this would be the ideal place to hook in a generic post-download task processor for now, we'll - // just carry out hard coded behavior. these carry the risk of failing the transfer, and i could - // argue both ways for that being the correct behavior. revisit this later. + var destinationDirectory = System.IO.Path.GetDirectoryName(file.Filename.ToLocalFilename(baseDirectory: OptionsMonitor.CurrentValue.Directories.Downloads)); + var finalFilename = Files.MoveFile( sourceFilename: file.Filename.ToLocalFilename(baseDirectory: OptionsMonitor.CurrentValue.Directories.Incomplete), - destinationDirectory: System.IO.Path.GetDirectoryName(file.Filename.ToLocalFilename(baseDirectory: OptionsMonitor.CurrentValue.Directories.Downloads)), + destinationDirectory: destinationDirectory, overwrite: false, deleteSourceDirectoryIfEmptyAfterMove: true); -- cgit v1.2.3