Revision: 2768
http://skim-app.svn.sourceforge.net/skim-app/?rev=2768&view=rev
Author: hofman
Date: 2007-08-29 02:49:32 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
Only failing to copy pdf or skim file is an error when creating a PDF bundle.
Make sure there is always an error returned.
Add page width and height to document info.
Modified Paths:
--------------
trunk/SKDocument.m
trunk/SKInfoWindowController.m
Modified: trunk/SKDocument.m
===================================================================
--- trunk/SKDocument.m 2007-08-29 00:06:07 UTC (rev 2767)
+++ trunk/SKDocument.m 2007-08-29 09:49:32 UTC (rev 2768)
@@ -266,9 +266,11 @@
if (success = [self writeToURL:tmpURL ofType:typeName
error:outError]) {
- NSSet *ourExtensions = [NSSet setWithObjects:@"pdf", @"skim",
@"txt", @"text", @"rtf", nil];
+ NSSet *ourExtensions = [NSSet setWithObjects:@"pdf", @"skim",
@"txt", @"text", @"rtf", @"plist", nil];
+ NSSet *ourImportantExtensions = [NSSet setWithObjects:@"pdf",
@"skim", nil];
NSEnumerator *fileEnum;
NSString *file;
+ BOOL didMove;
NSMutableDictionary *attributes = [[fm
fileAttributesAtPath:path traverseLink:YES] mutableCopy];
unsigned long permissions = [[attributes
objectForKey:NSFilePosixPermissions] unsignedLongValue];
@@ -285,8 +287,11 @@
}
fileEnum = [[fm directoryContentsAtPath:tmpPath]
objectEnumerator];
- while (success && (file = [fileEnum nextObject]))
- success = [fm movePath:[tmpPath
stringByAppendingPathComponent:file] toPath:[path
stringByAppendingPathComponent:file] handler:nil];
+ while (success && (file = [fileEnum nextObject])) {
+ didMove = [fm movePath:[tmpPath
stringByAppendingPathComponent:file] toPath:[path
stringByAppendingPathComponent:file] handler:nil];
+ if (didMove == NO && [ourImportantExtensions
containsObject:[[file pathExtension] lowercaseString]])
+ success = NO;
+ }
if (success)
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/touch"
arguments:[NSArray arrayWithObjects:@"-fm", path, nil]];
@@ -318,6 +323,9 @@
exportUsingPanel = NO;
+ if (success == NO && outError != NULL && *outError == nil)
+ *outError = [NSError errorWithDomain:SKDocumentErrorDomain code:0
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Unable
to write file", @"Error description"), NSLocalizedDescriptionKey, nil]];
+
return success;
}
Modified: trunk/SKInfoWindowController.m
===================================================================
--- trunk/SKInfoWindowController.m 2007-08-29 00:06:07 UTC (rev 2767)
+++ trunk/SKInfoWindowController.m 2007-08-29 09:49:32 UTC (rev 2768)
@@ -170,8 +170,13 @@
[dictionary addEntriesFromDictionary:[pdfDoc documentAttributes]];
[dictionary setValue:[NSString stringWithFormat: @"%d.%d", [pdfDoc
majorVersion], [pdfDoc minorVersion]] forKey:@"Version"];
[dictionary setValue:[NSNumber numberWithInt:[pdfDoc pageCount]]
forKey:@"PageCount"];
- if ([pdfDoc pageCount])
- [dictionary setValue:SKSizeString([[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxCropBox].size, [[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxMediaBox].size) forKey:@"PageSize"];
+ if ([pdfDoc pageCount]) {
+ NSSize cropSize = [[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxCropBox].size;
+ NSSize mediaSize = [[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxMediaBox].size;
+ [dictionary setValue:SKSizeString(cropSize, mediaSize)
forKey:@"PageSize"];
+ [dictionary setValue:[NSNumber numberWithFloat:cropSize.width]
forKey:@"PageWidth"];
+ [dictionary setValue:[NSNumber numberWithFloat:cropSize.height]
forKey:@"PageHeight"];
+ }
[dictionary setValue:[[dictionary valueForKey:@"Keywords"]
componentsJoinedByString:@"\n"] forKey:@"KeywordsString"];
[dictionary setValue:[NSNumber numberWithBool:[pdfDoc isEncrypted]]
forKey:@"Encrypted"];
[dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsPrinting]]
forKey:@"AllowsPrinting"];
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit