Skip to content

Commit

Permalink
Merge pull request #1009 from sdercolin/feature/fix-open-vb-position
Browse files Browse the repository at this point in the history
Fix file system path handling by adding surrounding ""
  • Loading branch information
stakira authored Jan 25, 2024
2 parents 0c96d84 + bd2e00e commit 3e38321
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions OpenUtau.Core/Util/OS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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}\"";
}
}
}
}

0 comments on commit 3e38321

Please sign in to comment.