From 04a2737d399af8cdc349c0a6ecb1719d8a98ea1a Mon Sep 17 00:00:00 2001 From: Michael Migliore Date: Sat, 11 Jan 2025 14:37:51 +0100 Subject: [PATCH] Fix macOS multi file --- application/F3DNSDelegate.mm | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/application/F3DNSDelegate.mm b/application/F3DNSDelegate.mm index 3802d04d81..16a6072e17 100644 --- a/application/F3DNSDelegate.mm +++ b/application/F3DNSDelegate.mm @@ -14,18 +14,26 @@ // This is a subclass of NSApplicationDelegate. @interface F3DNSDelegateInternal : NSObject @property F3DStarter* Starter; +@property BOOL ShouldHandleFileOpening; @end @implementation F3DNSDelegateInternal @synthesize Starter; +@synthesize ShouldHandleFileOpening; // ---------------------------------------------------------------------------- - (BOOL)application:(NSApplication*)theApplication openFile:(NSString*)filename { (void)theApplication; - Starter->AddFile([filename UTF8String]); - Starter->LoadFileGroup(); - Starter->Render(); + if (ShouldHandleFileOpening) + { + int index = Starter->AddFile([filename UTF8String]); + if (index > -1) + { + Starter->LoadFileGroup(index); + } + Starter->Render(); + } return YES; } @@ -105,6 +113,13 @@ - (void)applicationWillFinishLaunching:(NSNotification *)notification action:@selector(toggleFullScreen:) keyEquivalent:@"f"] setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; + + ShouldHandleFileOpening = false; +} + +- (void)applicationDidFinishLaunching:(NSNotification *)notification +{ + ShouldHandleFileOpening = true; } @end