From 6fd6b4b5b092d1739578bc497712c70fa6f621a7 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Wed, 10 Jun 2009 22:56:24 +0000 Subject: [PATCH] potentially (hopefully) fix bug where some users couldn't add torrents --- macosx/Controller.m | 9 ++++++--- macosx/DragOverlayWindow.m | 3 ++- macosx/Torrent.m | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index aa25a7b2b..2a822dea8 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -2456,7 +2456,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy NSString * fullFile = [path stringByAppendingPathComponent: file]; - if (![[[NSWorkspace sharedWorkspace] typeOfFile: fullFile error: NULL] isEqualToString: @"org.bittorrent.torrent"]) + if (![[[NSWorkspace sharedWorkspace] typeOfFile: fullFile error: NULL] isEqualToString: @"org.bittorrent.torrent"] + || [[fullFile pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame) continue; tr_ctor * ctor = tr_ctorNew(fLib); @@ -2698,7 +2699,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy NSArray * files = [pasteboard propertyListForType: NSFilenamesPboardType]; for (NSString * file in files) { - if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"]) + if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"] + || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame) { torrent = YES; tr_ctor * ctor = tr_ctorNew(fLib); @@ -2759,7 +2761,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy NSMutableArray * filesToOpen = [NSMutableArray arrayWithCapacity: [files count]]; for (NSString * file in files) { - if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"]) + if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"] + || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame) { torrent = YES; tr_ctor * ctor = tr_ctorNew(fLib); diff --git a/macosx/DragOverlayWindow.m b/macosx/DragOverlayWindow.m index 8d13595a5..d241ffbc3 100644 --- a/macosx/DragOverlayWindow.m +++ b/macosx/DragOverlayWindow.m @@ -83,7 +83,8 @@ for (NSString * file in files) { - if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"]) + if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"] + || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame) { tr_ctor * ctor = tr_ctorNew(fLib); tr_ctorSetMetainfoFromFile(ctor, [file UTF8String]); diff --git a/macosx/Torrent.m b/macosx/Torrent.m index e2a5935af..7f6633582 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1641,7 +1641,7 @@ int trashDataFile(const char * filename) if (path) result = tr_ctorSetMetainfoFromFile(ctor, [path UTF8String]); - //backup - shouldn't be needed after upgrade to 1.62 + //backup - shouldn't be needed after upgrade to 1.70 if (result != TR_OK && hashString) result = tr_ctorSetMetainfoFromHash(ctor, [hashString UTF8String]);