From 9dc7f726e978237bdf15898d0f10e9f848d574d3 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 4 Oct 2022 20:45:28 -0700 Subject: [PATCH] Use default directory for folder browsing, if possible (fixes #412) --- CHANGELIST.md | 1 + MPF/ViewModels/MainViewModel.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 38f57e3f..9f4ff5cb 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -129,6 +129,7 @@ - Update to DIC 20220909 - Possibly fix PIC parsing - Add PS3 folder/file checks for detection +- Use default directory for folder browsing, if possible ### 2.3 (2022-02-05) - Start overhauling Redump information pulling, again diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF/ViewModels/MainViewModel.cs index e41d50c5..db38897d 100644 --- a/MPF/ViewModels/MainViewModel.cs +++ b/MPF/ViewModels/MainViewModel.cs @@ -793,7 +793,15 @@ namespace MPF.UI.ViewModels /// private void BrowseFolder() { - WinForms.FolderBrowserDialog folderDialog = new WinForms.FolderBrowserDialog { ShowNewFolderButton = false, SelectedPath = System.AppDomain.CurrentDomain.BaseDirectory }; + string currentPath = App.Options.DefaultOutputPath; + if (string.IsNullOrWhiteSpace(currentPath) || !Directory.Exists(currentPath)) + currentPath = System.AppDomain.CurrentDomain.BaseDirectory; + + WinForms.FolderBrowserDialog folderDialog = new WinForms.FolderBrowserDialog + { + ShowNewFolderButton = false, + SelectedPath = currentPath, + }; WinForms.DialogResult result = folderDialog.ShowDialog(); if (result == WinForms.DialogResult.OK)