Revision: 28311
          http://sourceforge.net/p/bibdesk/svn/28311
Author:   hofman
Date:     2023-07-14 08:54:20 +0000 (Fri, 14 Jul 2023)
Log Message:
-----------
calculate parent directory first

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

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2023-07-14 08:40:42 UTC (rev 28310)
+++ trunk/bibdesk/BibDocument.m 2023-07-14 08:54:20 UTC (rev 28311)
@@ -1263,6 +1263,7 @@
     NSFileManager *fm = [NSFileManager defaultManager];
     NSWorkspace *ws = [NSWorkspace sharedWorkspace];
     NSString *filePath;
+    NSString *parent;
     NSString *commonParent = nil;
     NSMutableSet *localFiles = [NSMutableSet set];
     NSSet *localFileFields = [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey] ? [[BDSKTypeManager sharedManager] 
localFileFieldsSet] : nil;
@@ -1273,19 +1274,15 @@
             for (BDSKLinkedFile *file in [item localFiles]) {
                 if ((filePath = [file path]) && [fm fileExistsAtPath:filePath] 
&& [ws isFolderAtPath:filePath] == NO) {
                     [localFiles addObject:filePath];
-                    if (commonParent)
-                        commonParent = [[filePath 
stringByDeletingLastPathComponent] commonRootPathOfFile:commonParent];
-                    else
-                        commonParent = [filePath 
stringByDeletingLastPathComponent];
+                    parent = [filePath stringByDeletingLastPathComponent];
+                    commonParent = commonParent ? [parent 
commonRootPathOfFile:commonParent] : parent;
                 }
             }
             for (NSString *field in localFileFields) {
                 if ((filePath = [[item localFileURLForField:field] path]) && 
[fm fileExistsAtPath:filePath] && [ws isFolderAtPath:filePath] == NO) {
                     [localFiles addObject:filePath];
-                    if (commonParent)
-                        commonParent = [[filePath 
stringByDeletingLastPathComponent] commonRootPathOfFile:commonParent];
-                    else
-                        commonParent = [filePath 
stringByDeletingLastPathComponent];
+                    parent = [filePath stringByDeletingLastPathComponent];
+                    commonParent = commonParent ? [parent 
commonRootPathOfFile:commonParent] : parent;
                 }
             }
         }

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