<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -61,10 +61,10 @@ static void usage( FILE * fp, int exitCode )
 	fprintf( fp,
 			 &quot;Usage:\n&quot;
 			 &quot;  %s [-h | --help]					Display this list of options.\n&quot;,
-			 &quot;  %s [-a | --app-path] &lt;file-path&gt;	Set file at &lt;file-path&gt; to open using\n&quot;
-			 &quot;                                      application bundle at &lt;app-path&gt;.\n&quot;
-			 &quot;  %s [-b | --bundle-id] &lt;file-path&gt;	Set file at &lt;file-path&gt; to open using\n&quot;
-			 &quot;                                      application with the given bundle id.\n&quot;,
+			 &quot;  %s [-a | --app-path] &lt;file1&gt; &lt;file2&gt; ...\n&quot;
+			 &quot;     Set named files to open using application bundle at &lt;app-path&gt;.\n&quot;
+			 &quot;  %s [-b | --bundle-id] &lt;file1&gt; &lt;file2&gt; ...\n&quot;
+			 &quot;     Set named files to open using application with a given identifier.\n&quot;,
 			 procName, procName, procName );
 	fflush( fp );
 	exit( exitCode );
@@ -190,40 +190,54 @@ int main (int argc, const char * argv[])
 	if ( optind &gt;= argc )
 		usage( stderr, EX_USAGE );
 	
-	NSURL * fileURL = [NSURL fileURLWithPath: [NSString stringWithUTF8String: argv[optind]]];
+	// build the list of input files
+	NSMutableArray * files = [NSMutableArray array];
+	for ( int i = optind; i &lt; argc; i++ )
+		[files addObject: [NSURL fileURLWithPath: [NSString stringWithUTF8String: argv[optind]]]];
 	
-	if ( [[NSFileManager defaultManager] fileExistsAtPath: [fileURL path]] == NO )
-	{
-		fprintf( stderr, &quot;File not found: %s&quot;, argv[optind] );
-		fflush( stderr );
-		exit( EX_DATAERR );
-	}
-	
-	// got all the URLs we need now
-	
-	// get the file's UTI
-	NSString * uti = [[fileURL resourceValuesForKeys: [NSArray arrayWithObject: NSURLTypeIdentifierKey] error: NULL] objectForKey: NSURLTypeIdentifierKey];
-	
-	// remove any old usro resource
-	// if an app wasn't specified then we only remove the resource
-	RemoveUsroResource( fileURL );
-	if ( appURL == nil )
-	{
-		[fileURL setResourceValue: [NSNull null] forKey: NSURLCustomIconKey error: NULL];
-		return ( EX_OK );
-	}
+	__block int result = EX_OK;
 	
-	InstallUsroResource( fileURL, appURL );
-	NSImage * customIcon = GetAppFileIcon( appURL, fileURL, uti );
-	if ( customIcon != nil )
+	// Use some concurrency if available-- makes more sense when files are being thrown in by a script somewhere.
+	// That said, it would make sense if I added the ability to input files using stdin (empty-line terminated?).
+	[files enumerateObjectsWithOptions: NSEnumerationConcurrent usingBlock: ^(id fileURL, NSUInteger idx, BOOL *stop)
 	{
-		if ( [fileURL setResourceValue: customIcon forKey: NSURLCustomIconKey error: NULL] == NO )
+		if ( [[NSFileManager defaultManager] fileExistsAtPath: [fileURL path]] == NO )
 		{
-			fprintf( stderr, &quot;Failed to set custom icon for file.\n&quot; );
+			fprintf( stderr, &quot;File not found: %s&quot;, argv[optind] );
 			fflush( stderr );
-			exit( EX_SOFTWARE );
+			result = EX_DATAERR;
+			*stop = YES;
+			return;
 		}
-	}
+		
+		// got all the URLs we need now
+		
+		// get the file's UTI
+		NSString * uti = [[fileURL resourceValuesForKeys: [NSArray arrayWithObject: NSURLTypeIdentifierKey] error: NULL] objectForKey: NSURLTypeIdentifierKey];
+		
+		// remove any old usro resource
+		// if an app wasn't specified then we only remove the resource
+		RemoveUsroResource( fileURL );
+		if ( appURL == nil )
+		{
+			[fileURL setResourceValue: [NSNull null] forKey: NSURLCustomIconKey error: NULL];
+			return;
+		}
+		
+		InstallUsroResource( fileURL, appURL );
+		NSImage * customIcon = GetAppFileIcon( appURL, fileURL, uti );
+		if ( customIcon != nil )
+		{
+			if ( [fileURL setResourceValue: customIcon forKey: NSURLCustomIconKey error: NULL] == NO )
+			{
+				fprintf( stderr, &quot;Failed to set custom icon for file.\n&quot; );
+				fflush( stderr );
+				result = EX_SOFTWARE;
+				*stop = YES;
+				return;
+			}
+		}
+	}];
 	
-    return ( EX_OK );
+    return ( result );
 }</diff>
      <filename>SetAppAffinity.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>25c5723a42338a672b88d0ec3b793c09798abf9b</id>
    </parent>
  </parents>
  <author>
    <name>Jim Dovey</name>
    <email>jimdovey@mac.com</email>
  </author>
  <url>http://github.com/AlanQuatermain/SetAppAffinity/commit/7df72cf19b88030409324db8881e1ed2da541786</url>
  <id>7df72cf19b88030409324db8881e1ed2da541786</id>
  <committed-date>2009-10-28T15:37:50-07:00</committed-date>
  <authored-date>2009-10-28T15:37:50-07:00</authored-date>
  <message>Implemented means to specify more than one input file on the command line.</message>
  <tree>3d1b8d26f26422a3e7b9cfb239e02f6062e9fc10</tree>
  <committer>
    <name>Jim Dovey</name>
    <email>jimdovey@mac.com</email>
  </committer>
</commit>
