diff --git a/OpenUtau.Core/Util/OS.cs b/OpenUtau.Core/Util/OS.cs index 94d25e57a..a432ce589 100644 --- a/OpenUtau.Core/Util/OS.cs +++ b/OpenUtau.Core/Util/OS.cs @@ -13,22 +13,23 @@ public static void OpenFolder(string path) { if (Directory.Exists(path)) { Process.Start(new ProcessStartInfo { FileName = GetOpener(), - Arguments = path, + Arguments = GetWrappedPath(path), }); } } public static void GotoFile(string path) { if (File.Exists(path)) { + var wrappedPath = GetWrappedPath(path); if (IsWindows()) { Process.Start(new ProcessStartInfo { FileName = GetOpener(), - Arguments = $"/select, {path}", + Arguments = $"/select, {wrappedPath}", }); } else if (IsMacOS()) { Process.Start(new ProcessStartInfo { FileName = GetOpener(), - Arguments = $" -R {path}", + Arguments = $" -R {wrappedPath}", }); } else { OpenFolder(Path.GetDirectoryName(path)); @@ -95,5 +96,12 @@ private static string GetOpener() { } throw new IOException($"None of {string.Join(", ", linuxOpeners)} found."); } + private static string GetWrappedPath(string path) { + if (IsWindows()) { + return path; + } else { + return $"\"{path}\""; + } + } } }