Revision: 5955
http://skim-app.svn.sourceforge.net/skim-app/?rev=5955&view=rev
Author: hofman
Date: 2009-10-26 19:40:52 +0000 (Mon, 26 Oct 2009)
Log Message:
-----------
simplify temporary changing locking and read permissions
Modified Paths:
--------------
trunk/SKMainDocument.m
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2009-10-26 19:25:19 UTC (rev 5954)
+++ trunk/SKMainDocument.m 2009-10-26 19:40:52 UTC (rev 5955)
@@ -389,28 +389,24 @@
}
- BOOL isLocked = NO;
- BOOL isReadOnly = NO;
FSRef fileRef;
FSCatalogInfo catalogInfo;
FSCatalogInfoBitmap whichInfo = kFSCatInfoNone;
+
if (CFURLGetFSRef((CFURLRef)absoluteURL, &fileRef) &&
noErr == FSGetCatalogInfo(&fileRef, kFSCatInfoNodeFlags |
kFSCatInfoPermissions, &catalogInfo, NULL, NULL, NULL)) {
- isLocked = (catalogInfo.nodeFlags & kFSNodeLockedMask) != 0;
- isReadOnly = (PERMISSIONS_MODE(catalogInfo) & 0x80) == 0;
- if (isLocked || isReadOnly) {
- FSCatalogInfo tmpCatalogInfo = catalogInfo;
- if (isLocked) {
- tmpCatalogInfo.nodeFlags &= ~kFSNodeLockedMask;
- whichInfo |= kFSCatInfoNodeFlags;
- }
- if (isReadOnly) {
- PERMISSIONS_MODE(tmpCatalogInfo) |= 0x80;
- whichInfo |= kFSCatInfoPermissions;
- }
- (void)FSSetCatalogInfo(&fileRef, whichInfo,
&tmpCatalogInfo);
+ FSCatalogInfo tmpCatalogInfo = catalogInfo;
+ if ((catalogInfo.nodeFlags & kFSNodeLockedMask) != 0) {
+ tmpCatalogInfo.nodeFlags &= ~kFSNodeLockedMask;
+ whichInfo |= kFSCatInfoNodeFlags;
}
+ if ((PERMISSIONS_MODE(catalogInfo) & 0x80) == 0) {
+ PERMISSIONS_MODE(tmpCatalogInfo) |= 0x80;
+ whichInfo |= kFSCatInfoPermissions;
+ }
+ if (whichInfo != kFSCatInfoNone)
+ (void)FSSetCatalogInfo(&fileRef, whichInfo,
&tmpCatalogInfo);
}
if (NO == [[NSFileManager defaultManager] writeSkimNotes:[[self
notes] valueForKey:@"SkimNoteProperties"] textNotes:[self notesString]
richTextNotes:[self notesRTFData] toExtendedAttributesAtURL:absoluteURL
error:NULL]) {
@@ -429,7 +425,7 @@
if (options)
[[SKNExtendedAttributeManager sharedManager]
setExtendedAttributeNamed:PRESENTATION_OPTIONS_KEY toPropertyListValue:options
atPath:[absoluteURL path] options:kSKNXattrDefault error:NULL];
- if (isLocked || isReadOnly)
+ if (whichInfo != kFSCatInfoNone)
(void)FSSetCatalogInfo(&fileRef, whichInfo, &catalogInfo);
[[NSDistributedNotificationCenter defaultCenter]
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit