mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
fix<Windows>: explorer does not recognize path with separator '/'
This commit is contained in:
parent
59052d8e1f
commit
280ef60111
1 changed files with 14 additions and 6 deletions
|
@ -81,17 +81,25 @@ namespace SourceGit.Native {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenInFileManager(string path, bool select) {
|
public void OpenInFileManager(string path, bool select) {
|
||||||
if (select) {
|
var fullpath = string.Empty;
|
||||||
Process.Start("explorer", $"/select,\"{path}\"");
|
if (File.Exists(path)) {
|
||||||
|
fullpath = new FileInfo(path).FullName;
|
||||||
} else {
|
} else {
|
||||||
Process.Start("explorer", path);
|
fullpath = new DirectoryInfo(path).FullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (select) {
|
||||||
|
Process.Start("explorer", $"/select,\"{fullpath}\"");
|
||||||
|
} else {
|
||||||
|
Process.Start("explorer", fullpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenWithDefaultEditor(string file) {
|
public void OpenWithDefaultEditor(string file) {
|
||||||
var info = new ProcessStartInfo("cmd", $"/c start {file}");
|
var info = new FileInfo(file);
|
||||||
info.CreateNoWindow = true;
|
var start = new ProcessStartInfo("cmd", $"/c start {info.FullName}");
|
||||||
Process.Start(info);
|
start.CreateNoWindow = true;
|
||||||
|
Process.Start(start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue