Revision: 28320
          http://sourceforge.net/p/bibdesk/svn/28320
Author:   hofman
Date:     2023-07-16 21:43:18 +0000 (Sun, 16 Jul 2023)
Log Message:
-----------
only redirect relative paths in fields for SaveAs and SaveTo operations, not 
for any Autosave operation

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

Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2023-07-16 14:47:33 UTC (rev 28319)
+++ trunk/bibdesk/BibDocument.h 2023-07-16 21:43:18 UTC (rev 28320)
@@ -284,6 +284,7 @@
     NSDictionary *mainWindowSetupDictionary;
     
     NSURL *saveTargetURL;
+    NSSaveOperationType currentSaveOperation;
     
     NSInvocation *shouldCloseInvocation;
     

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2023-07-16 14:47:33 UTC (rev 28319)
+++ trunk/bibdesk/BibDocument.m 2023-07-16 21:43:18 UTC (rev 28320)
@@ -237,6 +237,9 @@
         // need to set this for new documents
         docState.documentStringEncoding = [BDSKStringEncodingManager 
defaultEncoding];
         
+        saveTargetURL = nil;
+        currentSaveOperation = NSNotFound;
+        
         // these are created lazily when needed
         pboardHelper = nil;
         fileSearchController = nil;
@@ -1213,10 +1216,12 @@
 - (BOOL)writeSafelyToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName 
forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError;
 {
     saveTargetURL = [absoluteURL copy];
+    currentSaveOperation = saveOperation;
     
     BOOL didSave = [super writeSafelyToURL:absoluteURL ofType:typeName 
forSaveOperation:saveOperation error:outError];
     
     BDSKDESTROY(saveTargetURL);
+    currentSaveOperation = NSNotFound;
     
     if (didSave) {
         NSFileManager *fm = [NSFileManager defaultManager];
@@ -1430,7 +1435,7 @@
         options |= BDSKBibTeXOptionTeXify;
     if (drop)
         options |= BDSKBibTeXOptionDropInternal;
-    if (aBasePath && [self fileURL] && [aBasePath isEqualToString:[self 
basePath]] == NO)
+    if ((currentSaveOperation == NSSaveAsOperation || currentSaveOperation == 
NSSaveToOperation) && aBasePath && [self fileURL] && [aBasePath 
isEqualToString:[self basePath]] == NO)
         options |= BDSKBibTeXOptionRedirectRelativeFiles;
     
     if([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKShouldUseTemplateFileKey]){

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to