Revision: 2746
http://skim-app.svn.sourceforge.net/skim-app/?rev=2746&view=rev
Author: hofman
Date: 2007-08-28 09:12:35 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Make sure existing PDF bundle is writable when saving.
Modified Paths:
--------------
trunk/SKDocument.m
Modified: trunk/SKDocument.m
===================================================================
--- trunk/SKDocument.m 2007-08-28 15:34:11 UTC (rev 2745)
+++ trunk/SKDocument.m 2007-08-28 16:12:35 UTC (rev 2746)
@@ -255,8 +255,8 @@
if (fileExists == NO || isDir == NO) {
success = [super saveToURL:absoluteURL ofType:typeName
forSaveOperation:saveOperation error:outError];
} else {
+ NSString *filename = [path lastPathComponent];
NSString *tmpDir =
SKUniqueDirectoryCreating(NSTemporaryDirectory(), YES);
- NSString *filename = [path lastPathComponent];
NSString *tmpPath = [tmpDir
stringByAppendingPathComponent:filename];
NSURL *tmpURL = [NSURL fileURLWithPath:tmpPath];
@@ -265,10 +265,15 @@
NSSet *knownExtensions = [NSSet setWithObjects:@"pdf",
@"skim", @"txt", @"text", @"rtf", nil];
NSEnumerator *fileEnum;
NSString *file;
+ NSMutableDictionary *attributes = [[fm
fileAttributesAtPath:path traverseLink:YES] mutableCopy];
+ unsigned long permissions = [[attributes
objectForKey:NSFilePosixPermissions] unsignedLongValue];
+
+ [attributes setObject:[NSNumber
numberWithUnsignedLong:permissions | 0200] forKey:NSFilePosixPermissions];
+ if ([attributes fileIsImmutable])
+ [attributes setObject:[NSNumber numberWithBool:NO]
forKey:NSFileImmutable];
+ [fm changeFileAttributes:attributes atPath:path];
+ [attributes release];
- if ([[[fm fileAttributesAtPath:path traverseLink:YES]
objectForKey:NSFileImmutable] boolValue])
- [fm changeFileAttributes:[NSDictionary
dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], NSFileImmutable,
nil] atPath:path];
-
fileEnum = [[fm directoryContentsAtPath:path]
objectEnumerator];
while (file = [fileEnum nextObject]) {
if ([knownExtensions containsObject:[[file pathExtension]
lowercaseString]])
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