Changeset 13327
- Timestamp:
- May 29, 2012, 1:53:36 AM (9 years ago)
- Location:
- trunk/macosx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/AddWindowController.h
r13324 r13327 46 46 47 47 Torrent * fTorrent; 48 NSString * fDestination, * fTorrentFile; 48 NSURL * fTorrentFile; 49 NSString * fDestination; 49 50 BOOL fLockDestination; 50 51 -
trunk/macosx/AddWindowController.m
r13324 r13327 66 66 fController = controller; 67 67 68 fTorrentFile = [[ torrentFile stringByExpandingTildeInPath] retain];68 fTorrentFile = [[NSURL alloc] initFileURLWithPath: [torrentFile stringByExpandingTildeInPath]]; 69 69 70 70 fDeleteTorrentInitial = deleteTorrent; -
trunk/macosx/Torrent.h
r13162 r13327 120 120 - (void) setPriority: (tr_priority_t) priority; 121 121 122 + (void) trashFile: (NS String *) path;122 + (void) trashFile: (NSURL *) fileURL; 123 123 - (void) moveTorrentDataFileTo: (NSString *) folder; 124 124 - (void) copyTorrentFileTo: (NSString *) path; -
trunk/macosx/Torrent.m
r13251 r13327 95 95 @autoreleasepool 96 96 { 97 NSLog(@"%s", filename); 97 98 if (filename != NULL) 98 [Torrent trashFile: [NSString stringWithUTF8String: filename]]; 99 { 100 [Torrent trashFile: [NSURL fileURLWithPath: [NSString stringWithUTF8String: filename]]]; 101 NSLog(@"%@\n%@", [NSString stringWithUTF8String: filename], [NSURL fileURLWithPath: [NSString stringWithUTF8String: filename]]); 102 } 99 103 } 100 104 return 0; … … 115 119 { 116 120 if (torrentDelete && ![[self torrentLocation] isEqualToString: path]) 117 [Torrent trashFile: path];121 [Torrent trashFile: [NSURL fileURLWithPath: path]]; 118 122 } 119 123 return self; … … 493 497 } 494 498 495 #warning when 10.6-only use recycleURLs:completionHandler: 496 + (void) trashFile: (NSString *) path 497 { 498 //attempt to move to trash 499 if (![[NSWorkspace sharedWorkspace] performFileOperation: NSWorkspaceRecycleOperation 500 source: [path stringByDeletingLastPathComponent] destination: @"" 501 files: [NSArray arrayWithObject: [path lastPathComponent]] tag: nil]) 502 { 503 //if cannot trash, just delete it (will work if it's on a remote volume) 504 NSError * error; 505 if (![[NSFileManager defaultManager] removeItemAtPath: path error: &error]) 506 NSLog(@"Could not trash %@: %@", path, [error localizedDescription]); 507 } 499 + (void) trashFile: (NSURL *) fileURL 500 { 501 [[NSWorkspace sharedWorkspace] recycleURLs: [NSArray arrayWithObject: fileURL] completionHandler: ^(NSDictionary * newURLs, NSError * error) { 502 if (error) 503 NSLog(@"Could not trash %@: %@", [fileURL path], [error localizedDescription]); 504 }]; 508 505 } 509 506
Note: See TracChangeset
for help on using the changeset viewer.