Should warning, that english is not my native, sorry for grammar misstakes.
I have a problem with shortcut that i create with NSIS. The shortcut's link leads to exe file, that use a json config, config is in the same directory with exe, and when i use the shortcut it returns me an error, that it can't finde the config, cause it's searching in the shortcut's directory. But when i make the shortcut by myself it works correct - searching config in the exe's directory. I need to create the shortcut, that will uses a config which lies in instdir. How to make it correctly?
That's how i create the shortcut:
CreateShortCut "$DESKTOP\%link_name%.lnk" \
"$INSTDIR\%SomeDir%\Application.exe" \
"" \
"C:\Users\Daniil.Bogdanov\Pic\logo.ico" 0
The config and exe lie in %SomeDir%
This isn't the most intuitive thing but CreateShortCut sets the working directory for your shortcut based on the current $OUTDIR
value.
https://nsis.sourceforge.io/Docs/Chapter4.html#createshortcut
$OUTDIR is stored as the shortcut's working directory property. You can change it by using SetOutPath before creating the shortcut
So I'm guessing that your output path isn't the same as the location of your executable. This could be remedied by using SetOutputPath
right before creating your shortcut.
SetOutPath "$INSTDIR\%SomeDir%\"
CreateShortCut "$DESKTOP\%link_name%.lnk" \
"$INSTDIR\%SomeDir%\Application.exe" \
"" \
"C:\Users\Daniil.Bogdanov\Pic\logo.ico" 0