From e28fcceb70ef95100704d61f5a3ee847f6592996 Mon Sep 17 00:00:00 2001 From: tompnub <166602591+tompnub@users.noreply.github.com> Date: Fri, 26 Sep 2025 11:03:24 +0200 Subject: [PATCH] Update BclLauncher.cs to use ArgumentList property Using the ArgumentList property avoids having to escape spaces and special characters, which would otherwise cause the open command to fail and either split the argument string or not find the required files and folders with special characters. --- .../Platform/Storage/FileIO/BclLauncher.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Base/Platform/Storage/FileIO/BclLauncher.cs b/src/Avalonia.Base/Platform/Storage/FileIO/BclLauncher.cs index 242b8e6d41b..96f489a222c 100644 --- a/src/Avalonia.Base/Platform/Storage/FileIO/BclLauncher.cs +++ b/src/Avalonia.Base/Platform/Storage/FileIO/BclLauncher.cs @@ -49,13 +49,17 @@ private static bool Exec(string urlOrFile) } else if (OperatingSystemEx.IsWindows() || OperatingSystemEx.IsMacOS()) { - using var process = Process.Start(new ProcessStartInfo + var info = new ProcessStartInfo { FileName = OperatingSystemEx.IsWindows() ? urlOrFile : "open", - Arguments = OperatingSystemEx.IsMacOS() ? $"{urlOrFile}" : "", CreateNoWindow = true, UseShellExecute = OperatingSystemEx.IsWindows() - }); + }; + // Using the argument list avoids having to escape spaces and other special + // characters that are part of valid macos file and folder paths. + if (OperatingSystemEx.IsMacOS()) + info.ArgumentList.Add(urlOrFile); + using var process = Process.Start(info); return true; } else