Revision: 2765
http://skim-app.svn.sourceforge.net/skim-app/?rev=2765&view=rev
Author: hofman
Date: 2007-08-28 16:59:10 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Add the text of the PDF to the text for indexing.
Modified Paths:
--------------
trunk/SkimImporter/GetMetadataForFile.m
Modified: trunk/SkimImporter/GetMetadataForFile.m
===================================================================
--- trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 23:57:57 UTC (rev
2764)
+++ trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 23:59:10 UTC (rev
2765)
@@ -58,19 +58,19 @@
notePath = (NSString *)pathToFile;
sourcePath = [[(NSString *)pathToFile stringByDeletingPathExtension]
stringByAppendingPathExtension:@"pdf"];
} else if (UTTypeEqual(contentTypeUTI,
CFSTR("net.sourceforge.skim-app.pdfd"))) {
- notePath = [(NSString *)pathToFile
stringByAppendingPathComponent:@"data.skim"];
+ notePath = [(NSString *)pathToFile
stringByAppendingPathComponent:@"notes.skim"];
}
if (notePath && [[NSFileManager defaultManager]
fileExistsAtPath:notePath]) {
NSData *data = [[NSData alloc] initWithContentsOfFile:notePath
options:NSUncachedRead error:NULL];
if (data) {
+ NSMutableString *textContent = [[NSMutableString alloc] init];
NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
[data release];
if (array) {
NSEnumerator *noteEnum = [array objectEnumerator];
NSDictionary *note;
- NSMutableString *textContent = [[NSMutableString alloc] init];
NSMutableArray *notes = [[NSMutableArray alloc] init];
while (note = [noteEnum nextObject]) {
NSString *contents = [note objectForKey:@"contents"];
@@ -87,11 +87,21 @@
[textContent appendString:text];
}
}
- [(NSMutableDictionary *)attributes setObject:textContent
forKey:(NSString *)kMDItemTextContent];
[(NSMutableDictionary *)attributes setObject:notes
forKey:@"net_sourceforge_skim_app_notes"];
[textContent release];
[notes release];
}
+
+ if (UTTypeEqual(contentTypeUTI,
CFSTR("net.sourceforge.skim-app.pdfd"))) {
+ NSString *textPath = [(NSString *)pathToFile
stringByAppendingPathComponent:@"data.txt"];
+ NSString *string = [NSString
stringWithContentsOfFile:textPath];
+ if ([string length]) {
+ if ([textContent length])
+ [textContent appendString:@"\n\n"];
+ [textContent appendString:string];
+ }
+ }
+ [(NSMutableDictionary *)attributes setObject:textContent
forKey:(NSString *)kMDItemTextContent];
}
[(NSMutableDictionary *)attributes setObject:@"Skim" forKey:(NSString
*)kMDItemCreator];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit