Archive: Start Menu Link Behaving Abnormally


Start Menu Link Behaving Abnormally
  Greetings...

Thanks for the great installer. We just love it.

We are going to use your installer for our product SQLyog.

In the .nsi file we have a section for Desktop+Start Menu

Section "Start Menu + Desktop Icons"
SectionIn 1 2 3
SetOutPath $SMPROGRAMS\SQLyog
CreateShortCut "$SMPROGRAMS\SQLyog\SQLyog.lnk" "$INSTDIR\SQLyog.exe"
'"$INSTDIR\makensis.exe" /CD'
SetOutPath $INSTDIR
CreateShortCut "$DESKTOP\SQLyog.lnk" "$INSTDIR\SQLyog.exe"
SectionEnd

Our product SQLyog creates a sqlyog.ini for keeping some information. Now
the problem is that when we are running SQLyog from the desktop icon, the
.ini file is getting creates at F:\program files\sqlyog but when we start
SQLyog from the start menu, the .ini file is getting created in the start
menu program directory which is making the sqlyog.ini also visible in the
start menu.

Any ideas about it ?

Please reply as we plan to ship the product out in 2 weeks. You help will be
appreciated.

Congrats again for making such a good installer.

Rgds
Ritesh
Webyog.com


I think this is not related to the installer.

Just make sure that your program creates the file in the application directory.


The shortcut's starting directory is determined by the out path. If you use SetOutPath $SMPROGRAMS\SQLyog and then CreateShortCut the shortcut will be created with the starting directory of $SMPROGRAMS\SQLyog. You used this out path before you created the start menu shortcut and that's why the INI file is created there, probably because you just used OpenFile("sqlyog.ini") in your program instead of including the full path.

If you want the starting directory to be $INSTDIR for both use:

SetOutPath $INSTDIR

CreateShortCut "$SMPROGRAMS\\SQLyog\\SQLyog.lnk" "$INSTDIR\\SQLyog.exe"
>CreateShortCut "$DESKTOP\\SQLyog.lnk" "$INSTDIR\\SQLyog.exe"

Using the full path in the program is much safer.


Thanks.

We now use aboslute path and everything works fine.

Thanks for your help.

Ritesh