Is there a way to use shortcuts in windows as symlinks in linux for local packages?

Hello,

I am developing a template that is currently only on my own GitLab instance (usually on Linux).
To have a convenient dev experience but still always the most current version in my local typst folder I create a symlink to the git repo subfolder which has the necessary template structure

# If the folders does not yet exist:
mkdir -p ~/.local/share/typst/packages/local/
# Add symbolic link
ln -s $(realpath thesis-template/my-fancy-template) ~/.local/share/typst/packages/local/

Thus I can develop and at the same time the symlink in ~/.local/share/typst/packages/local/ always points to the most current version without having to copy paste stuff.


I also tried this on my Windows machine and created the folder
C:\Users\user\AppData\Roaming\typst\packages\local\ and from there a Windows shortcut that points to the package in the git folder.
But here typst doesn’t build. Error:

error: package not found (searched for @local/my-fancy-template:0.1.0)

When I copy/paste the folder it works fine…
Are Windows shortcuts not “transparent” (in contrast to the Linux symlinks)? Is this something that could be “fixed” in typst, as it makes developing (in my opinion) way more convenient?

EDIT:
Ok sorry, just read more about Windows shortcuts and they just seem to be a quite different thing than Linux symlinks :sweat_smile:
So the only question that remains is, whether it would be possible by typst to also follow .lnk files and whether this would be easily achievable.
Gonna continue working on Linux for the moment :see_no_evil:

On Windows, it is called a Junction.

If you wanted to create a directory junction (a hard link to a folder) at “C:\LinkToFolder” that pointed to “C:\Users\Name\OriginalFolder,” you’d run the following command:

mklink /J C:\LinkToFolder C:\Users\Name\OriginalFolder

You’ll need to put quotation marks around paths with spaces. For example, if the folders are instead named “C:\Link To Folder” and “C:\Users\Name\Original Folder,” you’d use the following command instead:

mklink /J "C:\Link To Folder" "C:\Users\Name\Original Folder"
2 Likes

Thanks for the fast answer. :smiling_face:
I’m not very experienced with windows if it’s not in the UI :smile:

Gonna test it tomorrow.

1 Like

For your information, Link Shell Extension adds it to UI.


1 Like

Could try it today and works like a charm. Thanks :blush:

Two notes for others trying this:

  • mklink is only available in the Command Prompt, not in Powershell
  • I had to restart VSCodium, otherwise tinymist didn’t find the package (typst commands compile and watch work directly)
2 Likes