Some software projects (notably LLVM/Clang) install internal symlinks to enable varying behaviors based on argv[0] (clang and clang++ are symlinked to the same binary but executing via the clang++ symlink enables C++). This is a useful space saving feature not only for the installer, but also in the target directory.
Windows 10 has greatly improved support for creating symlinks without elevation as long as developer mode is active. This works fine for a project built and installed on the same machine (via cmake for example) but becomes a challenge to replicate on other users' systems.
If NSIS could detect such internal symlinks (one that points to a regular file also included in the installer) it could represent this node accordingly in the installer and attempt to recreate the symlink on the end user's system. Should this attempt fail, it should fall back to a duplicating file copy.
I guess it would be easier to create hard links, as there is no need for developer mode while building and running the installer. NSIS saves duplicate files only once in the installer, so we could check if the same file is already saved and create a hard link to it.
Edit: In
Source/exehead/exec.c
atcase EW_EXTRACTFILE
we could check if we have saved a file a the same offset already (in this case check param2) and callCreateHardLink(newFile, alreadySavedFile, NULL)
.This works because
CEXEBuild::datablock_optimize()
saves the same file to the same offset.Last edit: Paul Schwabauer 2024-01-02