Revision: 2771
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2771&view=rev
Author:   hofman
Date:     2007-08-29 08:27:36 -0700 (Wed, 29 Aug 2007)

Log Message:
-----------
Check enclosed PDF file for file changes of a PDF bundle.

Modified Paths:
--------------
    trunk/SKDocument.m

Modified: trunk/SKDocument.m
===================================================================
--- trunk/SKDocument.m  2007-08-29 12:30:28 UTC (rev 2770)
+++ trunk/SKDocument.m  2007-08-29 15:27:36 UTC (rev 2771)
@@ -989,6 +989,25 @@
                 return;
             }
             
+            NSString *extension = [fileName pathExtension];
+            if (extension) {
+                NSString *theUTI = 
[(id)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, 
(CFStringRef)extension, NULL) autorelease];
+                if (theUTI && UTTypeConformsTo((CFStringRef)theUTI, 
CFSTR("application/x-dvi"))) {
+                    return;
+                } if (theUTI && UTTypeConformsTo((CFStringRef)theUTI, 
CFSTR("net.sourceforge.skim-app.pdfd"))) {
+                    NSString *pdfFile = [fileName 
stringByAppendingPathComponent:@"data.pdf"];
+                    if ([[NSFileManager defaultManager] 
fileExistsAtPath:pdfFile]) {
+                        fileName = pdfFile;
+                    } else {
+                        NSArray *subfiles = [[NSFileManager defaultManager] 
subpathsAtPath:fileName];
+                        unsigned int index = [[subfiles 
valueForKeyPath:@"pathExtension.lowercaseString"] indexOfObject:@"pdf"];
+                        if (index == NSNotFound)
+                            return;
+                        fileName = [fileName 
stringByAppendingPathComponent:[subfiles objectAtIndex:index]];
+                    }
+                }
+            }
+            
             NSFileHandle *fh = [NSFileHandle 
fileHandleForReadingAtPath:fileName];
             
             // read the last 1024 bytes of the file (or entire file); Adobe's 
spec says they allow %%EOF anywhere in that range


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