From bdea1dad0ace3b6ec2cbd2b780b3fed568a5c9c3 Mon Sep 17 00:00:00 2001 From: tompnub <166602591+tompnub@users.noreply.github.com> Date: Fri, 20 Feb 2026 14:31:16 +0100 Subject: [PATCH] Update BclLauncher.cs to use ArgumentList property (#19713) 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. Co-authored-by: Julien Lebosquain --- .../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 242b8e6d41..96f489a222 100644 --- a/src/Avalonia.Base/Platform/Storage/FileIO/BclLauncher.cs +++ b/src/Avalonia.Base/Platform/Storage/FileIO/BclLauncher.cs @@ -49,13 +49,17 @@ internal class BclLauncher : ILauncher } 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