Revision: 28312 http://sourceforge.net/p/bibdesk/svn/28312 Author: hofman Date: 2023-07-14 09:28:42 +0000 (Fri, 14 Jul 2023) Log Message: ----------- calculate common parent after getting all parents, many or all of them may be the same
Modified Paths: -------------- trunk/bibdesk/BibDocument.m Modified: trunk/bibdesk/BibDocument.m =================================================================== --- trunk/bibdesk/BibDocument.m 2023-07-14 08:54:20 UTC (rev 28311) +++ trunk/bibdesk/BibDocument.m 2023-07-14 09:28:42 UTC (rev 28312) @@ -1263,7 +1263,7 @@ NSFileManager *fm = [NSFileManager defaultManager]; NSWorkspace *ws = [NSWorkspace sharedWorkspace]; NSString *filePath; - NSString *parent; + NSMutableSet *parents = [NSMutableSet set]; NSString *commonParent = nil; NSMutableSet *localFiles = [NSMutableSet set]; NSSet *localFileFields = [[NSUserDefaults standardUserDefaults] boolForKey:BDSKUseLocalUrlAndUrlKey] ? [[BDSKTypeManager sharedManager] localFileFieldsSet] : nil; @@ -1274,19 +1274,20 @@ for (BDSKLinkedFile *file in [item localFiles]) { if ((filePath = [file path]) && [fm fileExistsAtPath:filePath] && [ws isFolderAtPath:filePath] == NO) { [localFiles addObject:filePath]; - parent = [filePath stringByDeletingLastPathComponent]; - commonParent = commonParent ? [parent commonRootPathOfFile:commonParent] : parent; + [parents addObject:[filePath stringByDeletingLastPathComponent]]; } } for (NSString *field in localFileFields) { if ((filePath = [[item localFileURLForField:field] path]) && [fm fileExistsAtPath:filePath] && [ws isFolderAtPath:filePath] == NO) { [localFiles addObject:filePath]; - parent = [filePath stringByDeletingLastPathComponent]; - commonParent = commonParent ? [parent commonRootPathOfFile:commonParent] : parent; + [parents addObject:[filePath stringByDeletingLastPathComponent]]; } } } + for (filePath in parents) + commonParent = commonParent ? [filePath commonRootPathOfFile:commonParent] : filePath; + NSData *bibtexData = [self bibTeXDataDroppingInternal:NO relativeToPath:commonParent error:outError]; NSURL *bibtexURL = [folderURL URLByAppendingPathComponent:[targetName stringByAppendingPathExtension:@"bib"] isDirectory:NO]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit