Skip to content

Display the wsl node in FolderPicker and FileSavePicker dialog navigation#6326

Draft
DinahK-2SO wants to merge 2 commits intomainfrom
user/DinahK-2SO/display_wsl_node_in_filedialog_navigation
Draft

Display the wsl node in FolderPicker and FileSavePicker dialog navigation#6326
DinahK-2SO wants to merge 2 commits intomainfrom
user/DinahK-2SO/display_wsl_node_in_filedialog_navigation

Conversation

@DinahK-2SO
Copy link
Contributor

Problem

The WSL navigation node (e.g. \\wsl.localhost) is missing from the navigation pane of FolderPicker and FileSavePicker dialogs. Users with WSL installed cannot browse to WSL file systems from these pickers without manually navigating to the \\wsl.localhost paths.

This is caused by undocumented behavior in the Windows Common Item Dialog:

  1. The FileSavePicker (IFileSaveDialog) never shows the WSL node in its navigation pane.
  2. The FolderPicker (IFileOpenDialog with FOS_PICKFOLDERS) hides the WSL node regardless of whether FOS_ALLOWMULTISELECT is set. The FOS_FORCEFILESYSTEM option (added in #5446 to prevent selection of invalid locations like "This PC") contributes to this, but is not the sole cause.

FileOpenPicker (file mode, no FOS_PICKFOLDERS) is unaffected and already shows the WSL node.

Fix

Manually insert the WSL root node into the dialog's navigation pane using INameSpaceTreeControl::AppendRoot. A shared IFileDialogEvents handler (PickerCommon::WslNavigationInserter) is registered on the dialog before Show(). On the first OnFolderChange (when the dialog window just launched) callback it:

  1. Obtains INameSpaceTreeControl from the live dialog via IServiceProviderSID_STopLevelBrowserIShellBrowserINameSpaceTreeControl.
  2. Creates a shell item for the WSL root (\\wsl.localhost, falling back to \\wsl$).
  3. Starts a polling timer that waits for the Shell's built-in navigation roots (Home, This PC, Network, etc.) to finish loading, then appends the WSL node. This delay prevents the WSL node from appearing at the top of the tree.

Cleanup (CancelPendingInsertion) runs via wil::scope_exit after Show() returns, cancelling any pending timer.

The event handler registration (Advise) uses SUCCEEDED() instead of check_hresult() so that the picker still opens normally if registration fails.

@DinahK-2SO DinahK-2SO changed the title Display the wsl node. Display the wsl node in FolderPicker and FileSavePicker dialog navigation Mar 23, 2026
@DinahK-2SO DinahK-2SO marked this pull request as draft March 23, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant