Merge pull request #2596 from wabbajack-tools/AidanMaskelyne-pr-branch

Use the default file manager when opening a folder.
This commit is contained in:
trawzified 2024-08-13 22:33:35 +02:00 committed by GitHub
commit 4cc08cfc0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 6 deletions

View File

@ -6,6 +6,7 @@
* Added logging to determine which downloaded files cannot be hashed * Added logging to determine which downloaded files cannot be hashed
* This could occur in the downloading phase when installing a modlist when there are broken/corrupted files in the downloads folder * This could occur in the downloading phase when installing a modlist when there are broken/corrupted files in the downloads folder
* Fixed Wabbajack crashing when double-clicking the browser window titlebar or URL * Fixed Wabbajack crashing when double-clicking the browser window titlebar or URL
* Fixed Wabbajack always using explorer.exe instead of the default file browser
#### Version - 3.7.0.0 - 6/21/2024 #### Version - 3.7.0.0 - 6/21/2024
* Added Starfield support * Added Starfield support

View File

@ -56,7 +56,6 @@ namespace Wabbajack
} }
} }
public static void OpenWebsite(Uri url) public static void OpenWebsite(Uri url)
{ {
Process.Start(new ProcessStartInfo("cmd.exe", $"/c start {url}") Process.Start(new ProcessStartInfo("cmd.exe", $"/c start {url}")
@ -64,16 +63,23 @@ namespace Wabbajack
CreateNoWindow = true, CreateNoWindow = true,
}); });
} }
public static void OpenFolder(AbsolutePath path) 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) public static AbsolutePath OpenFileDialog(string filter, string initialDirectory = null)
{ {
OpenFileDialog ofd = new OpenFileDialog(); OpenFileDialog ofd = new OpenFileDialog();

View File

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