mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-12 11:31:09 +00:00
Refactoring
This commit is contained in:
1 parent
bb86ebc606
commit
ce77e73428
2 files changed
+2
-14
No files matched your search
@@ -282,7 +282,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
||||
|
||||
|
||||
private func pressAcceptButton(transferID: String) {
|
||||
if true || (!isPlusVersion() && transmissionCount() > 0) {
|
||||
if false || (!isPlusVersion() && transmissionCount() > 0) {
|
||||
|
||||
self.continueTransmission(accept: true, transferID: transferID, storeInTemp: true)
|
||||
log("Showing plus screen...")
|
||||
|
||||
@@ -471,24 +471,12 @@ public class SaveFilesManager {
|
||||
for file in files {
|
||||
|
||||
let fileName = file.lastPathComponent
|
||||
var destinationURL = target.appendingPathComponent(fileName)
|
||||
let destinationURL = target.appendingPathComponent(fileName)
|
||||
|
||||
if !filesFinishedDownloading.contains(destinationURL) {
|
||||
log("File \(file) not finished downloading, skipping")
|
||||
log("Pending files: \(filesFinishedDownloading)")
|
||||
continue
|
||||
}
|
||||
|
||||
var counter = 1
|
||||
let fileExtension = destinationURL.pathExtension
|
||||
let baseName = destinationURL.deletingPathExtension().lastPathComponent
|
||||
|
||||
while fileManager.fileExists(atPath: destinationURL.path) {
|
||||
let newFileName = "\(baseName)-\(counter)"
|
||||
let newFileNameWithExtension = fileExtension.isEmpty ? newFileName : "\(newFileName).\(fileExtension)"
|
||||
destinationURL = target.appendingPathComponent(newFileNameWithExtension)
|
||||
counter += 1
|
||||
}
|
||||
|
||||
log("Moving file: \(file.lastPathComponent) to \(destinationURL.lastPathComponent)")
|
||||
try fileManager.copyItem(at: file, to: destinationURL)
|
||||
|
||||
Reference in new issue
Block a user