From 226dcc9cf297dcfb929650852dc29209035b4b3d Mon Sep 17 00:00:00 2001 From: ionite34 Date: Sun, 14 Jan 2024 17:40:39 +0800 Subject: [PATCH] Fix non-macos StartApp filename and args --- CHANGELOG.md | 4 ++++ .../Processes/ProcessRunner.cs | 21 ++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7e8c3e4..f7e0b2dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to Stability Matrix will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). +## v2.8.0-pre.2 +### Fixed +- Fixed Auto-update failing to start new version on Windows and Linux when path contains spaces + ## v2.8.0-pre.1 ### Added - Added Package Extensions (Plugins) management - accessible from the Packages' 3-dot menu. Currently supports ComfyUI and A1111. diff --git a/StabilityMatrix.Core/Processes/ProcessRunner.cs b/StabilityMatrix.Core/Processes/ProcessRunner.cs index ed092b93..aa2ecc25 100644 --- a/StabilityMatrix.Core/Processes/ProcessRunner.cs +++ b/StabilityMatrix.Core/Processes/ProcessRunner.cs @@ -34,20 +34,21 @@ public static class ProcessRunner /// public static Process StartApp(string path, ProcessArgs args) { + var startInfo = new ProcessStartInfo(); + if (Compat.IsMacOS) { - var startInfo = new ProcessStartInfo - { - FileName = "open", - Arguments = args.Prepend([path, "--args"]), - UseShellExecute = true - }; - - return Process.Start(startInfo) - ?? throw new NullReferenceException("Process.Start returned null"); + startInfo.FileName = "open"; + startInfo.Arguments = args.Prepend(path).ToString(); + startInfo.UseShellExecute = true; + } + else + { + startInfo.FileName = path; + startInfo.Arguments = args; } - return Process.Start(args.Prepend(path)); + return Process.Start(startInfo) ?? throw new NullReferenceException("Process.Start returned null"); } ///