浏览代码

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 (Settings.UIProperties.OpenInSameWindow)
+            if (Settings.UIProperties.OpenInSameWindow && !ProcessHelper.CheckIfAnotherInstanceIsRunning())
             {
                 // No other instance is running, create named pipe server
                 _ = IPC.StartListeningForArguments(vm);