I'll try to make myself as clear as possible.
I made an installation program with NSIS. An icon was created on the desktop and when I double-click it, the application lanches well. However, in the install directory I have other directories (like "css" which contains "style.css"), and it seems that the program is looking for my css file in the directory of the shortcut (-> desktop).
How could I make the program looking in the install directory rather than in the desktop ?
Thanks for your answers.
Here is the code I used :
Section "Shortcuts"
SectionIn 2
SetOutPath "$SMPROGRAMS\MyApp"
CreateShortCut "$SMPROGRAMS\MyApp\MyApp.lnk" "$INSTDIR\MyApp.exe"
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\MyApp.exe"
SectionEnd
If I change the outpath (line 3) to "$INSTDIR", the shortcut isn't created at all. If I use this code, the shortcut is created but the "start in" parameter is set to the desktop.
The problem in this case is that your application is using relative paths without qualifying them; the simple solution is to have the shortcut specify the working directory: (it seems strange that the SetOutPath
alters the CreateShortCut
, but the manual says it does)
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\MyApp.exe" # etc.
The proper solution is to make all paths absolute; you've tagged it as qt
so I presume you're using Qt and C++. Search around for "qt absolute path" and things like that - e.g. Qt-interest Archive - How to get an application's absolute path?