Revision: 22199
          http://sourceforge.net/p/bibdesk/svn/22199
Author:   hofman
Date:     2018-04-30 12:10:14 +0000 (Mon, 30 Apr 2018)
Log Message:
-----------
only override writeSafelyToURL on NFS disk

Modified Paths:
--------------
    trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2018-04-30 06:31:00 UTC (rev 22198)
+++ trunk/bibdesk/BibDocument.m 2018-04-30 12:10:14 UTC (rev 22199)
@@ -1225,32 +1225,31 @@
      Always use the workaround path in that case, based on the mount type.  
Tested by automounting an RHEL5 export on 10.5.7.
      Unknown whether this is needed on 10.4, but NSAppKitVersionNumber check 
is needed because of the condition below.
      */
-     NSString *fsType = nil;
-     if ([[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:[absoluteURL 
path] isRemovable:NULL isWritable:NULL isUnmountable:NULL description:NULL 
type:&fsType] == NO)
-         fsType = nil;
-     BOOL didSave;
-
-     // same conditional as used for workaround code path
-     if ([absoluteURL isFileURL] && NSAutosaveOperation != saveOperation && 
[[fsType lowercaseString] isEqualToString:@"nfs"])
-         didSave = NO;
-     else
-         didSave = [super writeSafelyToURL:absoluteURL ofType:typeName 
forSaveOperation:saveOperation error:outError];
+    NSString *fsType = nil;
+    if ([[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:[absoluteURL 
path] isRemovable:NULL isWritable:NULL isUnmountable:NULL description:NULL 
type:&fsType] == NO)
+        fsType = nil;
+    BOOL didSave = NO;
     
-    /* 
-     This is a workaround for 
https://sourceforge.net/tracker/index.php?func=detail&aid=1867790&group_id=61487&atid=497423
-     Filed as rdar://problem/5679370
-     
-     I'm not sure what the semantics of this operation are for 
NSAutosaveOperation, so it's excluded (but uses a different code path anyway, 
at least on Leopard).  This also doesn't get hit for save-as or save-to since 
they don't do a safe-save, but they're handled anyway.  FSExchangeObjects 
apparently avoids the bugs in FSPathReplaceObject, but doesn't preserve all of 
the metadata that those do.  It's a shame that Apple can't preserve the file 
content as well as they preserve the metadata; I'd rather lose the ACLs than 
lose my bibliography.
-     
-     TODO:  xattr handling, package vs. flat file (overwrite directory)?  
-     xattrs from BibDesk seem to be preserved, so I'm not going to bother with 
that.
-     
-     TESTED:  On AFP volume served by 10.4.11 Server, saving from 10.5.1 
client; on AFP volume served by 10.5.1 client, saving from 10.5.1 client.  
Autosave, Save-As, and Save were tested.  Saving to a local HFS+ volume doesn't 
hit this code path, and neither does saving to a FAT-32 thumb drive.
-     
-     */
-    
-    if (NO == didSave && [absoluteURL isFileURL] && NSAutosaveOperation != 
saveOperation) {
+    // same conditional as used for workaround code path
+    if ([absoluteURL isFileURL] == NO || NSAutosaveOperation == saveOperation 
|| [[fsType lowercaseString] isEqualToString:@"nfs"] == NO) {
         
+        didSave = [super writeSafelyToURL:absoluteURL ofType:typeName 
forSaveOperation:saveOperation error:outError];
+        
+    } else {
+        
+        /*
+         This is a workaround for 
https://sourceforge.net/tracker/index.php?func=detail&aid=1867790&group_id=61487&atid=497423
+         Filed as rdar://problem/5679370
+         
+         I'm not sure what the semantics of this operation are for 
NSAutosaveOperation, so it's excluded (but uses a different code path anyway, 
at least on Leopard).  This also doesn't get hit for save-as or save-to since 
they don't do a safe-save, but they're handled anyway.  FSExchangeObjects 
apparently avoids the bugs in FSPathReplaceObject, but doesn't preserve all of 
the metadata that those do.  It's a shame that Apple can't preserve the file 
content as well as they preserve the metadata; I'd rather lose the ACLs than 
lose my bibliography.
+         
+         TODO:  xattr handling, package vs. flat file (overwrite directory)?
+         xattrs from BibDesk seem to be preserved, so I'm not going to bother 
with that.
+         
+         TESTED:  On AFP volume served by 10.4.11 Server, saving from 10.5.1 
client; on AFP volume served by 10.5.1 client, saving from 10.5.1 client.  
Autosave, Save-As, and Save were tested.  Saving to a local HFS+ volume doesn't 
hit this code path, and neither does saving to a FAT-32 thumb drive.
+         
+         */
+        
         NSFileManager *fileManager = [NSFileManager defaultManager];
         
         // this will create a new file on the same volume as the original 
file, which we will overwrite

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to