Repository navigation
feat: open Markdown files from File Explorer through Windows file associations - #637
Merged
Merged
Conversation
…ions # Conflicts: # docs/architecture.md # src/test/utils/tauriApi.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UserChoiceare left alone, and choosing Leafdown is the user's step in Windows.bundle.fileAssociations. In the installed bundler (CLI 2.11.4), both the NSIS and WiX templates write each extension's default value, which replaces another application's registration and makes Leafdown the default wherever the user has not chosen one. The NSIS template also leaves the executable path unquoted, and on reinstall it overwrites its_backupof the previous default with its own class. A Leafdown-owned NSIS hook and WiX fragment instead register aLeafdown.MarkdownProgID with a quoted command, anOpenWithProgidsvalue per extension, andCapabilitieslisted inRegisteredApplications.docs/decisions.mdrecords the choice.build.rsgenerates both installers' extension lists frommarkdown-file-extensions.jsoninto the gitignoredsrc-tauri/gen/windows/, so a new built-in extension needs no installer edit.componentRefsto a separateExternalfeature, where referencing the main binary's file key from registry values fails ICE69, so aSetPropertycarries the executable path. The NSIS uninstaller removes the registration only while the ProgID command still names its own executable, so uninstalling a stale install location leaves the current one's registration in place.Related Issue
Closes #630
Verification
Rust tests cover launch-path parsing (Unicode and spaces, relative paths, no argument, single take). They also check that the generated installer lists match the registry exactly, that both installers iterate those lists, that no installer writes an extension key outside
OpenWithProgids, and thattauri.conf.jsoncarries nofileAssociations. Frontend tests cover opening the launch document through the open workflow with recents and folder context, the ordinary unsupported-file and encoding errors, opening only after the window shows, and opening with default settings when preferences fail to load. A newlaunch-documentdesktop scenario launches the app with a Unicode path argument and checks the editor, article navigator selection, and recents.pnpm check,pnpm test:e2e:desktop:runner, andpnpm tauri build(NSIS and MSI) pass. The bundle also succeeds withsrc-tauri/gen/windows/deleted beforehand.Manually verified in Windows 11 with real release installers, against a machine that already had VS Code, Zed, and Typora registrations and a Notepad++
UserChoicefor.md, comparing registry snapshots after each step:OpenWithProgidsvalues, andUserChoiceunchanged.msiexec /fomusrepair after deleting owned values, upgrade to a later version, and uninstall restore the values, keep a single product, and return the registry to the baseline.Not verified: picking Leafdown in File Explorer's Open with menu and in Settings > Default apps by hand; the error toasts on screen (the error kinds were checked through diagnostics logs); the desktop scenarios, which are left to CI.
Notes
OpenWithProgidsvalue behind; the MSI removes it with the old product.INSTALLDIRfrom the install-directory key the NSIS uninstaller leaves inHKCU, so an MSI installed after an NSIS uninstall goes into the old NSIS folder.