Преглед изворни кода

Refine instance handling logic for macOS compatibility

Ruben пре 4 месеци
родитељ
комит
4045af86a5
1 измењених фајлова са 10 додато и 4 уклоњено
  1. 10 4
      src/PicView.Avalonia/StartUp/StartUpHelper.cs

+ 10 - 4
src/PicView.Avalonia/StartUp/StartUpHelper.cs

@@ -56,10 +56,16 @@ public static class StartUpHelper
                         }
                         }
                     });
                     });
                 }
                 }
-                else if (Settings.UIProperties.OpenInSameWindow &&
-                    ProcessHelper.CheckIfAnotherInstanceIsRunning())
+                else
                 {
                 {
-                    HandleMultipleInstances(args);
+                    if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+                    {
+                        if (Settings.UIProperties.OpenInSameWindow &&
+                            ProcessHelper.CheckIfAnotherInstanceIsRunning())
+                        {
+                            HandleMultipleInstances(args);
+                        }
+                    }
                 }
                 }
             }
             }
         }
         }
@@ -160,7 +166,7 @@ public static class StartUpHelper
 
 
         if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
         if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
         {
         {
-            if (Settings.UIProperties.OpenInSameWindow)
+            if (Settings.UIProperties.OpenInSameWindow && !ProcessHelper.CheckIfAnotherInstanceIsRunning())
             {
             {
                 // No other instance is running, create named pipe server
                 // No other instance is running, create named pipe server
                 _ = IPC.StartListeningForArguments(vm);
                 _ = IPC.StartListeningForArguments(vm);