Adds support for an initial directory in folder picker

Enhances the modern folder browser to accept and open to a specified initial directory.

This improves the user experience by starting the "Browse for Drivers" dialog in the project's 'Drivers' subfolder, reducing the need for manual navigation. The implementation uses the Win32 API to create a shell item from the initial path and set it as the dialog's starting folder.
This commit is contained in:
rbalsleyMSFT
2025-06-26 18:37:22 -07:00
parent 9bbb40ce8c
commit dfe07b16ae
2 changed files with 170 additions and 143 deletions
@@ -594,7 +594,8 @@ function Register-EventHandlers {
param($eventSource, $routedEventArgs)
$window = [System.Windows.Window]::GetWindow($eventSource)
$localState = $window.Tag
$selectedPath = Invoke-BrowseAction -Type 'Folder' -Title "Select Drivers Folder"
$initialDir = Join-Path -Path $localState.FFUDevelopmentPath -ChildPath "Drivers"
$selectedPath = Invoke-BrowseAction -Type 'Folder' -Title "Select Drivers Folder" -InitialDirectory $initialDir
if ($selectedPath) {
$localState.Controls.txtDriversFolder.Text = $selectedPath
}