Created
September 25, 2011 04:34
-
-
Save vade/1240236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double max = [URLs count]; | |
[importProgress setMaxValue:max]; | |
[NSApp beginSheet:importSheet | |
modalForWindow:libraryWindow | |
modalDelegate:self | |
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) | |
contextInfo:nil]; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
for(NSURL* aURL in URLs) | |
{ | |
if(self.cancelImport) | |
{ | |
self.cancelImport = NO; | |
break; | |
} | |
NSString* aPath = [aURL path]; | |
[aPath retain]; | |
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
[self.database addGamesFromPath:aPath toCollection:nil searchSubfolders:YES]; | |
}); | |
[importCurrentItem setStringValue:[[aPath lastPathComponent] stringByDeletingPathExtension]]; | |
[importProgress incrementBy:1.0]; | |
[importSheet display]; | |
[aPath release]; | |
} | |
[NSApp endSheet:importSheet]; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment