Revision: 4777
http://skim-app.svn.sourceforge.net/skim-app/?rev=4777&view=rev
Author: hofman
Date: 2008-10-12 17:26:51 +0000 (Sun, 12 Oct 2008)
Log Message:
-----------
Open PDF files with an erroneous .fdf extension, as provided by Springer
Modified Paths:
--------------
trunk/SKDocumentController.m
Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m 2008-10-12 16:36:48 UTC (rev 4776)
+++ trunk/SKDocumentController.m 2008-10-12 17:26:51 UTC (rev 4777)
@@ -250,6 +250,7 @@
NSString *type = [super typeForContentsOfURL:inAbsoluteURL error:&error];
if ([self documentClassForType:type] == NULL) {
+ // "open -f" creates a temporary file with a .txt extension, we want
to be able to open these file as it can be very handy to e.g. display man pages
and pretty printed text file from the command line
if ([inAbsoluteURL isFileURL]) {
NSString *fileName = [inAbsoluteURL path];
NSFileHandle *fh = [NSFileHandle
fileHandleForReadingAtPath:fileName];
@@ -262,6 +263,13 @@
}
if (type == nil && outError)
*outError = error;
+ } else if (SKIsNotesFDFDocumentType(type)) {
+ // Springer sometimes sends PDF files with an .fdf extension for
review, huh?
+ NSString *fileName = [inAbsoluteURL path];
+ NSFileHandle *fh = [NSFileHandle fileHandleForReadingAtPath:fileName];
+ NSData *leadingData = [fh readDataOfLength:headerLength];
+ if ([leadingData length] >= [pdfHeaderData length] && [pdfHeaderData
isEqual:[leadingData subdataWithRange:NSMakeRange(0, [pdfHeaderData length])]])
+ type = SKPDFDocumentType;
}
return type;
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