Revision: 2821
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2821&view=rev
Author:   hofman
Date:     2007-09-04 04:30:21 -0700 (Tue, 04 Sep 2007)

Log Message:
-----------
Allow spotlight indexing of PDF bundles whose .skim files have a different 
filename.

Modified Paths:
--------------
    trunk/SkimImporter/GetMetadataForFile.m

Modified: trunk/SkimImporter/GetMetadataForFile.m
===================================================================
--- trunk/SkimImporter/GetMetadataForFile.m     2007-09-04 11:04:17 UTC (rev 
2820)
+++ trunk/SkimImporter/GetMetadataForFile.m     2007-09-04 11:30:21 UTC (rev 
2821)
@@ -58,7 +58,17 @@
         notePath = (NSString *)pathToFile;
         sourcePath = [[(NSString *)pathToFile stringByDeletingPathExtension] 
stringByAppendingPathExtension:@"pdf"];
     } else if (UTTypeEqual(contentTypeUTI, 
CFSTR("net.sourceforge.skim-app.pdfd"))) {
-        notePath = [(NSString *)pathToFile 
stringByAppendingPathComponent:@"notes.skim"];
+        NSArray *files = [[NSFileManager defaultManager] 
subpathsAtPath:(NSString *)pathToFile];
+        NSString *noteFilename = @"notes.skim";
+        if ([files containsObject:noteFilename] == NO) {
+            noteFilename = [[[(NSString *)pathToFile lastPathComponent] 
stringByDeletingPathExtension] stringByAppendingPathExtension:@"skim"];
+            if ([files containsObject:noteFilename] == NO) {
+                unsigned index = [[files 
valueForKeyPath:@"pathExtension.lowercaseString"] indexOfObject:@"skim"];
+                noteFilename = index == NSNotFound ? nil : [files 
objectAtIndex:index];
+            }
+        }
+        if (noteFilename)
+            notePath = [(NSString *)pathToFile 
stringByAppendingPathComponent:noteFilename];
     }
     
     if (notePath && [[NSFileManager defaultManager] 
fileExistsAtPath:notePath]) {


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
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to