diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-05-11 19:15:13 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2024-05-11 19:15:13 -0500 |
| commit | 2c8a0d34b4bc89a0f51cdd0e5667cc4fa8ee5424 (patch) | |
| tree | d2d66f483ec27197b4e598313ad03b8125145475 | |
| parent | 7fe5b89ad8a211d0e1be1bd10a477ad9f7db51f2 (diff) | |
| download | slskd-2c8a0d34b4bc89a0f51cdd0e5667cc4fa8ee5424.tar.gz | |
temporarily comment old create/move
| -rw-r--r-- | src/slskd/Transfers/Downloads/DownloadService.cs | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index a8269b49..bf036e48 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -1,4 +1,4 @@ -// <copyright file="DownloadService.cs" company="slskd Team"> +// <copyright file="DownloadService.cs" company="slskd Team"> // Copyright (c) slskd Team. All rights reserved. // // This program is free software: you can redistribute it and/or modify @@ -588,62 +588,62 @@ namespace slskd.Transfers.Downloads context.SaveChanges(); } - private static Stream GetLocalFileStream(string remoteFilename, string saveDirectory) - { - var localFilename = remoteFilename.ToLocalFilename(baseDirectory: saveDirectory); - var path = Path.GetDirectoryName(localFilename); - - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - - var options = new FileStreamOptions - { - Mode = FileMode.Create, - Access = FileAccess.Write, - }; - - if (!OperatingSystem.IsWindows()) - { - options.UnixCreateMode = UnixFileMode.GroupExecute | UnixFileMode.GroupRead | UnixFileMode.UserRead | UnixFileMode.UserExecute; - } - - return new FileStream(localFilename, options); - } - - private static string MoveFile(string filename, string sourceDirectory, string destinationDirectory) - { - var sourceFilename = filename.ToLocalFilename(sourceDirectory); - var destinationFilename = filename.ToLocalFilename(destinationDirectory); - - var destinationPath = Path.GetDirectoryName(destinationFilename); - - if (!Directory.Exists(destinationPath)) - { - Directory.CreateDirectory(destinationPath); - } - - if (File.Exists(destinationFilename)) - { - string extensionlessFilename = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename)); - string extension = Path.GetExtension(filename); - - while (File.Exists(destinationFilename)) - { - string filenameUTC = $"{extensionlessFilename}_{DateTime.UtcNow.Ticks}{extension}"; - destinationFilename = filenameUTC.ToLocalFilename(destinationDirectory); - } - } - - File.Move(sourceFilename, destinationFilename, overwrite: true); - - if (!Directory.EnumerateFileSystemEntries(Path.GetDirectoryName(sourceFilename)).Any()) - { - Directory.Delete(Path.GetDirectoryName(sourceFilename)); - } - - return destinationFilename; - } + // private static Stream GetLocalFileStream(string remoteFilename, string saveDirectory) + // { + // var localFilename = remoteFilename.ToLocalFilename(baseDirectory: saveDirectory); + // var path = Path.GetDirectoryName(localFilename); + + // if (!Directory.Exists(path)) + // { + // Directory.CreateDirectory(path); + // } + + // var options = new FileStreamOptions + // { + // Mode = FileMode.Create, + // Access = FileAccess.Write, + // }; + + // if (!OperatingSystem.IsWindows()) + // { + // options.UnixCreateMode = UnixFileMode.GroupExecute | UnixFileMode.GroupRead | UnixFileMode.UserRead | UnixFileMode.UserExecute; + // } + + // return new FileStream(localFilename, options); + // } + + // private static string MoveFile(string filename, string sourceDirectory, string destinationDirectory) + // { + // var sourceFilename = filename.ToLocalFilename(baseDirectory: sourceDirectory); + // var destinationFilename = filename.ToLocalFilename(baseDirectory: destinationDirectory); + + // var destinationPath = Path.GetDirectoryName(destinationFilename); + + // if (!Directory.Exists(destinationPath)) + // { + // Directory.CreateDirectory(destinationPath); + // } + + // if (File.Exists(destinationFilename)) + // { + // string extensionlessFilename = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename)); + // string extension = Path.GetExtension(filename); + + // while (File.Exists(destinationFilename)) + // { + // string filenameUTC = $"{extensionlessFilename}_{DateTime.UtcNow.Ticks}{extension}"; + // destinationFilename = filenameUTC.ToLocalFilename(destinationDirectory); + // } + // } + + // File.Move(sourceFilename, destinationFilename, overwrite: true); + + // if (!Directory.EnumerateFileSystemEntries(Path.GetDirectoryName(sourceFilename)).Any()) + // { + // Directory.Delete(Path.GetDirectoryName(sourceFilename)); + // } + + // return destinationFilename; + // } } }
\ No newline at end of file |
