Revision: 5360
http://skim-app.svn.sourceforge.net/skim-app/?rev=5360&view=rev
Author: hofman
Date: 2009-05-07 11:25:47 +0000 (Thu, 07 May 2009)
Log Message:
-----------
Add a workaround for the problem that another app may override the UTI for one
of our readable types, which leads us to fail opening the file. This in
particular can happen for DVI, because this file type does not have a UTI.
Modified Paths:
--------------
trunk/SKDocumentController.m
Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m 2009-05-06 22:40:25 UTC (rev 5359)
+++ trunk/SKDocumentController.m 2009-05-07 11:25:47 UTC (rev 5360)
@@ -231,12 +231,23 @@
// "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];
+ NSString *extension = [fileName pathExtension];
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;
} else if ([leadingData length] >= [psHeaderData length] &&
[psHeaderData isEqual:[leadingData subdataWithRange:NSMakeRange(0,
[psHeaderData length])]]) {
type = SKPostScriptDocumentType;
+ } else if ([extension length]) {
+ // On 10.5 when another app declares a different UTI for one
of our types, we may get their UTI, rdar://problem/6864895
+ if ([extension caseInsensitiveCompare:@"pdf"] == NSOrderedSame)
+ type = SKPDFDocumentType;
+ else if ([extension caseInsensitiveCompare:@"ps"] ==
NSOrderedSame)
+ type = SKPostScriptDocumentType;
+ else if ([extension caseInsensitiveCompare:@"dvi"] ==
NSOrderedSame)
+ type = SKDVIDocumentType;
+ else if ([extension caseInsensitiveCompare:@"skim"] ==
NSOrderedSame)
+ type = SKNotesDocumentType;
}
}
if (type == nil && outError)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit