Revision: 4959
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4959&view=rev
Author:   hofman
Date:     2008-11-15 12:46:28 +0000 (Sat, 15 Nov 2008)

Log Message:
-----------
Remove deprecated ntoes file location in pdf bundle for importer. Check UTIs 
only once.

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

Modified: trunk/SkimImporter/GetMetadataForFile.m
===================================================================
--- trunk/SkimImporter/GetMetadataForFile.m     2008-11-13 17:57:32 UTC (rev 
4958)
+++ trunk/SkimImporter/GetMetadataForFile.m     2008-11-15 12:46:28 UTC (rev 
4959)
@@ -53,19 +53,18 @@
     Boolean success = FALSE;
     NSString *notePath = nil;
     NSString *sourcePath = nil;
+    BOOL isSkimNotes = UTTypeEqual(contentTypeUTI, 
CFSTR("net.sourceforge.skim-app.skimnotes"));
+    BOOL isPDFBundle = isSkimNotes == NO && UTTypeEqual(contentTypeUTI, 
CFSTR("net.sourceforge.skim-app.pdfd"));
     
-    if (UTTypeEqual(contentTypeUTI, 
CFSTR("net.sourceforge.skim-app.skimnotes"))) {
+    if (isSkimNotes) {
         notePath = (NSString *)pathToFile;
         sourcePath = [[(NSString *)pathToFile stringByDeletingPathExtension] 
stringByAppendingPathExtension:@"pdf"];
-    } else if (UTTypeEqual(contentTypeUTI, 
CFSTR("net.sourceforge.skim-app.pdfd"))) {
+    } else if (isPDFBundle) {
         NSArray *files = [[NSFileManager defaultManager] 
subpathsAtPath:(NSString *)pathToFile];
-        NSString *noteFilename = @"notes.skim";
+        NSString *noteFilename = [[[(NSString *)pathToFile lastPathComponent] 
stringByDeletingPathExtension] stringByAppendingPathExtension:@"skim"];
         if ([files containsObject:noteFilename] == NO) {
-            noteFilename = [[[(NSString *)pathToFile lastPathComponent] 
stringByDeletingPathExtension] stringByAppendingPathExtension:@"skim"];
-            if ([files containsObject:noteFilename] == NO) {
-                unsigned idx = [[files 
valueForKeyPath:@"pathExtension.lowercaseString"] indexOfObject:@"skim"];
-                noteFilename = idx == NSNotFound ? nil : [files 
objectAtIndex:idx];
-            }
+            unsigned idx = [[files 
valueForKeyPath:@"pathExtension.lowercaseString"] indexOfObject:@"skim"];
+            noteFilename = idx == NSNotFound ? nil : [files objectAtIndex:idx];
         }
         if (noteFilename)
             notePath = [(NSString *)pathToFile 
stringByAppendingPathComponent:noteFilename];
@@ -103,7 +102,7 @@
             }
         }
         
-        if (UTTypeEqual(contentTypeUTI, 
CFSTR("net.sourceforge.skim-app.pdfd"))) {
+        if (isPDFBundle) {
             NSString *textPath = [(NSString *)pathToFile 
stringByAppendingPathComponent:@"data.txt"];
             NSString *string = [NSString stringWithContentsOfFile:textPath];
             if ([string length]) {


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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to