Merge pull request #2592 from AidanMaskelyne/main

Use the default file manager when opening a folder.
This commit is contained in:
Luca 2024-07-08 22:30:05 +02:00 committed by GitHub
commit a4f3782eb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View File

@ -56,7 +56,6 @@ namespace Wabbajack
}
}
public static void OpenWebsite(Uri url)
{
Process.Start(new ProcessStartInfo("cmd.exe", $"/c start {url}")
@ -67,13 +66,20 @@ namespace Wabbajack
public static void OpenFolder(AbsolutePath path)
{
Process.Start(new ProcessStartInfo(KnownFolders.Windows.Combine("explorer.exe").ToString(), path.ToString())
string folderPath = path.ToString();
if (!folderPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
CreateNoWindow = true,
folderPath += Path.DirectorySeparatorChar.ToString();
}
Process.Start(new ProcessStartInfo()
{
FileName = folderPath,
UseShellExecute = true,
Verb = "open"
});
}
public static AbsolutePath OpenFileDialog(string filter, string initialDirectory = null)
{
OpenFileDialog ofd = new OpenFileDialog();

View File

@ -77,7 +77,7 @@ namespace Wabbajack
public void AfterInstallNavigation()
{
Process.Start("explorer.exe", Location.TargetPath.ToString());
UIUtils.OpenFolder(Location.TargetPath);
}
public async Task<bool> Install()