Skip to content

feat(windows): support displaying and opening .lnk shortcut files#87

Open
DryheeHuang-Here wants to merge 1 commit intoTkaixiang:trunkfrom
DryheeHuang-Here:feature/windows-shortcut-support
Open

feat(windows): support displaying and opening .lnk shortcut files#87
DryheeHuang-Here wants to merge 1 commit intoTkaixiang:trunkfrom
DryheeHuang-Here:feature/windows-shortcut-support

Conversation

@DryheeHuang-Here
Copy link

feat(windows): support displaying and opening .lnk shortcut files

Allow MarkText to show Windows shortcut (.lnk) files in the sidebar file tree and resolve them to their target files when opened. This enhancement treats shortcuts as if they were the actual files, improving the Windows experience.

Key changes:

  • Add "resolveShortcut" helper function that parses .lnk files and returns the resolved target path (or the original path if resolution fails)
  • In the sidebar file tree, filter .lnk files by checking whether the resolved target's extension is included in "MARKDOWN_EXTENSIONS"; only display those that point to supported file types
  • Update file opening logic to call "resolveShortcut" on the given path before reading the file with "fsPromises.readFile" in "loadMarkdownFile", ensuring the actual target content is loaded

Screenshots

This screenshot shows ".lnk" shortcut files now appearing in the sidebar and successfully opening the target Markdown document.

image

Show .lnk shortcut files in the sidebar only when they point to file types natively supported by MarkText (e.g., .md, .txt). When such a shortcut is clicked, its target file is opened directly. Shortcuts pointing to unsupported file types are filtered out and do not appear in the sidebar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant