Revision: 29551
http://sourceforge.net/p/bibdesk/svn/29551
Author: hofman
Date: 2025-09-08 09:03:57 +0000 (Mon, 08 Sep 2025)
Log Message:
-----------
add a comment, rename variales
Modified Paths:
--------------
trunk/bibdesk/BDSKDownloadManager.m
Modified: trunk/bibdesk/BDSKDownloadManager.m
===================================================================
--- trunk/bibdesk/BDSKDownloadManager.m 2025-09-08 08:58:23 UTC (rev 29550)
+++ trunk/bibdesk/BDSKDownloadManager.m 2025-09-08 09:03:57 UTC (rev 29551)
@@ -229,7 +229,7 @@
}
}
-- (void)decideDestinationWithSuggestedFilename:(NSString *)filename
modalForWindow:(NSWindow *)window completionHandler:(void (^)(NSURL *
destination))completionHandler {
+- (void)decideDestinationWithSuggestedFilename:(NSString *)filename
modalForWindow:(NSWindow *)window completionHandler:(void (^)(NSURL *
destinationURL))completionHandler {
NSString *extension = [filename pathExtension];
NSString *downloadsDirectory = [[[NSUserDefaults standardUserDefaults]
stringForKey:BDSKDownloadsDirectoryKey] stringByExpandingTildeInPath];
@@ -250,6 +250,7 @@
void (^handler)(NSModalResponse) = ^(NSModalResponse result){
if (result == NSModalResponseOK) {
NSURL *fileURL = [sPanel URL];
+ // if a file exists, the user should have confirmed to overwrite
if ([fileURL checkResourceIsReachableAndReturnError:NULL])
[[NSFileManager defaultManager] removeItemAtURL:fileURL
error:NULL];
completionHandler(fileURL);
@@ -358,11 +359,11 @@
filename = disposition;
}
- [downloadManager decideDestinationWithSuggestedFilename:filename
modalForWindow:nil completionHandler:^(NSURL *destination){
+ [downloadManager decideDestinationWithSuggestedFilename:filename
modalForWindow:nil completionHandler:^(NSURL *destinationURL){
NSError *error = nil;
- if (destination) {
- if ([[NSFileManager defaultManager] moveItemAtURL:[webDownload
fileURL] toURL:destination error:&error])
- [webDownload setFileURL:destination];
+ if (destinationURL) {
+ if ([[NSFileManager defaultManager] moveItemAtURL:[webDownload
fileURL] toURL:destinationURL error:&error])
+ [webDownload setFileURL:destinationURL];
} else {
error = [NSError errorWithDomain:NSURLErrorDomain
code:NSURLErrorCancelled userInfo:nil];
}
@@ -403,11 +404,11 @@
[downloadManager download:download didCompleteWithError:error];
}
-- (void)download:(WKDownload *)download
decideDestinationUsingResponse:(NSURLResponse *)response
suggestedFilename:(NSString *)filename completionHandler:(void (^)(NSURL *
destination))completionHandler API_AVAILABLE(macos(11.3)) {
- [downloadManager decideDestinationWithSuggestedFilename:filename
modalForWindow:[[download webView] window] completionHandler:^(NSURL
*destination){
- if (destination)
- [[downloadManager webDownloadForDownload:download]
setFileURL:destination];
- completionHandler(destination);
+- (void)download:(WKDownload *)download
decideDestinationUsingResponse:(NSURLResponse *)response
suggestedFilename:(NSString *)filename completionHandler:(void (^)(NSURL *
destinationURL))completionHandler API_AVAILABLE(macos(11.3)) {
+ [downloadManager decideDestinationWithSuggestedFilename:filename
modalForWindow:[[download webView] window] completionHandler:^(NSURL
*destinationURL){
+ if (destinationURL)
+ [[downloadManager webDownloadForDownload:download]
setFileURL:destinationURL];
+ completionHandler(destinationURL);
}];
}
@@ -425,8 +426,8 @@
[downloadManager decideDestinationWithSuggestedFilename:filename
modalForWindow:nil completionHandler:completionHandler];
}
-- (void)download:(BDSKDownload *)download didCreateDestination:(NSURL
*)locationURL {
- [[downloadManager webDownloadForDownload:download] setFileURL:locationURL];
+- (void)download:(BDSKDownload *)download didCreateDestination:(NSURL
*)destinationURL {
+ [[downloadManager webDownloadForDownload:download]
setFileURL:destinationURL];
}
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit