adium 2705:4ca570ee06cb: Apply more Spotlight grease.

commits at adium.im commits at adium.im
Sat Sep 12 16:42:48 UTC 2009


details:	http://hg.adium.im/adium/rev/4ca570ee06cb
revision:	2705:4ca570ee06cb
author:		Zachary West <zacw at adium.im>
date:		Sat Sep 12 12:42:43 2009 -0400

Apply more Spotlight grease.

diffs (31 lines):

diff -r 94ffd2caa8d1 -r 4ca570ee06cb Other/Adium Spotlight Importer/GetMetadataForFile.m
--- a/Other/Adium Spotlight Importer/GetMetadataForFile.m	Fri Sep 11 21:13:55 2009 -0400
+++ b/Other/Adium Spotlight Importer/GetMetadataForFile.m	Sat Sep 12 12:42:43 2009 -0400
@@ -264,14 +264,19 @@
 {
 	NSError *err=nil;
 	NSURL *furl = [NSURL fileURLWithPath:(NSString *)pathToFile];
-	NSString *contentString;
+	NSString *contentString = nil;
 	NSXMLDocument *xmlDoc;
-	xmlDoc = [[NSXMLDocument alloc] initWithContentsOfURL:furl
-												  options:NSXMLNodePreserveCDATA
-													error:&err];    
-	NSArray *contentArray = [xmlDoc nodesForXPath:@"//message//text()"
-											error:&err];
-	contentString = [contentArray componentsJoinedByString:@" "];
-	[xmlDoc release];
+	NSData *data = [NSData dataWithContentsOfURL:furl options:NSUncachedRead error:&err];
+	if (data) {
+		xmlDoc = [[NSXMLDocument alloc] initWithData:data options:NSXMLNodePreserveCDATA error:&err];
+	}
+	
+	if (xmlDoc) {
+		NSArray *contentArray = [xmlDoc nodesForXPath:@"//message//text()"
+												error:&err];
+		contentString = [contentArray componentsJoinedByString:@" "];
+		[xmlDoc release];
+	}
+	
 	return contentString;
 }




More information about the commits mailing list