Archive: Problem with directory


Problem with directory
Hi!
I have a problem with installation directory on NSIS.
Why appear this directory in my setup file?

http://www.melody.altervista.org/_al...ta_ht/NSIS.JPG

The code was generated by HM NSI Edit, but i think it's no important.

Help me!


Image doesn't load.

-Stu


http://img95.imageshack.us/my.php?image=nsis3ei.jpg


Please attach the script.


http://www.savefile.com/files/4789979


Take a look at HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\Starlight.exe. It probably contains that path. When you use InstallDirRegKey and the registry key exists, that's what the directory page is going to show.

Hit the Post a Reply button. There's an option to attach files, when you're not using the quick reply box.


Very thank you!
Another little question: why in the installation directory don't display "C:\Programs\Starlight 1" but "C:\Programs\Starlight 1\" ?


:(


Because that is the path stored in the registry?
A good way to clean up the $INSTDIR path is to move it on and back off the stack (whenever the contents of the $INSTDIR variable is changed it is validated by the installer).


Push $INSTDIR
Pop $INSTDIR


I'm not quite sure why it isn't validated already, because if I use StrCpy $INSTDIR "C:\Temp\" in .onInit, C:\Temp\ is the path I get on the Directory page. However if I use the above code just afterwards it becomes C:\Temp instead (no trailing backstroke).

You need to put this in your directory pages' PRE function (use !define MUI_PAGE_CUSTOMFUNCTION_PRE DirectoryPre).

-Stu

Problem unsolved :(

In other setup file build with NSIS there isn't the backslash at the end!


; Script generated by the HM NIS Edit Script Wizard.

BrandingText http://www.starlight.irc-zone.org

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Starlight"
!define PRODUCT_VERSION "2.02"
!define PRODUCT_PUBLISHER "Rand0m"
!define PRODUCT_WEB_SITE "http://www.starlight.irc-zone.org"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\mirc.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"

; MUI 1.67 compatible ------
!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install-nsis.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall-nsis.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-nsis.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-nsis.bmp"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "..\Licenza.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Start menu page
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Starlight 2"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\mirc.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "Italian"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\Starlight 2"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "SezionePrincipale" SEC01
Push $INSTDIR
SetOutPath "$INSTDIR"
Pop $INSTDIR
SetOverwrite try
File "..\..\..\..\Programmi\Starlight 2\mirc.exe"
File "..\..\..\..\Programmi\Starlight 2\mirc.ini"
File "..\..\..\..\Programmi\Starlight 2\servers.ini"
SetOutPath "$INSTDIR\System"
File "..\..\..\..\Programmi\Starlight 2\System\About.txt"
File "..\..\..\..\Programmi\Starlight 2\System\address.txt"
SetOutPath "$INSTDIR\System\Aliases"
File "..\..\..\..\Programmi\Starlight 2\System\Aliases\aliases.ini"
File "..\..\..\..\Programmi\Starlight 2\System\Aliases\Connection.ini"
File "..\..\..\..\Programmi\Starlight 2\System\Aliases\Docked.ini"
File "..\..\..\..\Programmi\Starlight 2\System\Aliases\mp3.ini"
File "..\..\..\..\Programmi\Starlight 2\System\Aliases\Protezioni.ini"
File "..\..\..\..\Programmi\Starlight 2\System\Aliases\Theme.ini"
SetOutPath "$INSTDIR\System\Background"
File "..\..\..\..\Programmi\Starlight 2\System\Background\0.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\1.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\10.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\11.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\12.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\13.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\14.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\15.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\2.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\3.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\4.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\5.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\6.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\7.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\8.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\9.gif"
File "..\..\..\..\Programmi\Starlight 2\System\Background\image.bmp"
File "..\..\..\..\Programmi\Starlight 2\System\Background\main.bmp"
File "..\..\..\..\Programmi\Starlight 2\System\Background\Thumbs.db"
File "..\..\..\..\Programmi\Starlight 2\System\Background\wizard.bmp"
SetOutPath "$INSTDIR\System\Dll"
File "..\..\..\..\Programmi\Starlight 2\System\Dll\dcx.dll"
File "..\..\..\..\Programmi\Starlight 2\System\Dll\mircustom.dll"
File "..\..\..\..\Programmi\Starlight 2\System\Dll\mOTFv3.dll"
File "..\..\..\..\Programmi\Starlight 2\System\Dll\UltraDock.dll"
File "..\..\..\..\Programmi\Starlight 2\System\Dll\WhileFix.dll"
SetOutPath "$INSTDIR\System"
File "..\..\..\..\Programmi\Starlight 2\System\Grafica.txt"
SetOutPath "$INSTDIR\System\Icons"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\Edit.ico"
SetOutPath "$INSTDIR\System\Icons\Library"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\Library\gnome.icl"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\Library\xp.icl"
SetOutPath "$INSTDIR\System\Icons"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\main.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\meno.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\mute.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\next.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\open.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\pause.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\pl.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\play.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\Plus.ICO"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\prev.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\repeatoff.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\shuffle.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\stop.ico"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\Thumbs.db"
File "..\..\..\..\Programmi\Starlight 2\System\Icons\voice.ico"
SetOutPath "$INSTDIR\System\Messaggi"
File "..\..\..\..\Programmi\Starlight 2\System\Messaggi\Away.txt"
File "..\..\..\..\Programmi\Starlight 2\System\Messaggi\quit.txt"
SetOutPath "$INSTDIR\System\Moduli"
File "..\..\..\..\Programmi\Starlight 2\System\Moduli\Auto.htb"
File "..\..\..\..\Programmi\Starlight 2\System\Moduli\Away.htb"
File "..\..\..\..\Programmi\Starlight 2\System\Moduli\mp3.htb"
File "..\..\..\..\Programmi\Starlight 2\System\Moduli\Protection.htb"
File "..\..\..\..\Programmi\Starlight 2\System\Moduli\Setup.htb"
File "..\..\..\..\Programmi\Starlight 2\System\Moduli\T9.htb"
File "..\..\..\..\Programmi\Starlight 2\System\Moduli\Theme.htb"
File "..\..\..\..\Programmi\Starlight 2\System\Moduli\Xpopup.htb"
SetOutPath "$INSTDIR\System"
File "..\..\..\..\Programmi\Starlight 2\System\Playlist.txt"
File "..\..\..\..\Programmi\Starlight 2\System\popups.ini"
File "..\..\..\..\Programmi\Starlight 2\System\remote.ini"
SetOutPath "$INSTDIR\System\Script"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Autoupdate.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Away.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Connection.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Events.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Miscellaneous.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\mp3.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Pannello di controllo.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Popup.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Protezioni.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Raw.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Setup.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Theme.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Toolbar.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Various.sls"
File "..\..\..\..\Programmi\Starlight 2\System\Script\Wizard.sls"

; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Starlight.lnk" "$INSTDIR\mirc.exe"
CreateShortCut "$DESKTOP\Starlight.lnk" "$INSTDIR\mirc.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Section -AdditionalIcons
SetOutPath $INSTDIR
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
CreateShortCut "$DESKTOP\Starlight.lnk" "INSTDIR\Starlight.exe" "" "$INSTDIR\System\Icons\Library\main.ico" 0
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\mirc.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\mirc.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) è stato completamente rimosso dal tuo computer."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Sei sicuro di voler completamente rimuovere $(^Name) e tutti i suoi componenti?" IDYES +2
Abort
FunctionEnd

Section Uninstall
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\System\Script\Wizard.sls"
Delete "$INSTDIR\System\Script\Various.sls"
Delete "$INSTDIR\System\Script\Toolbar.sls"
Delete "$INSTDIR\System\Script\Theme.sls"
Delete "$INSTDIR\System\Script\T9.sls"
Delete "$INSTDIR\System\Script\Setup.sls"
Delete "$INSTDIR\System\Script\Raw.sls"
Delete "$INSTDIR\System\Script\Protezioni.sls"
Delete "$INSTDIR\System\Script\Popup.sls"
Delete "$INSTDIR\System\Script\Pannello di controllo.sls"
Delete "$INSTDIR\System\Script\mp3.sls"
Delete "$INSTDIR\System\Script\Miscellaneous.sls"
Delete "$INSTDIR\System\Script\Events.sls"
Delete "$INSTDIR\System\Script\Connection.sls"
Delete "$INSTDIR\System\Script\Away.sls"
Delete "$INSTDIR\System\Script\Autoupdate.sls"
Delete "$INSTDIR\System\remote.ini"
Delete "$INSTDIR\System\popups.ini"
Delete "$INSTDIR\System\Playlist.txt"
Delete "$INSTDIR\System\Moduli\Xpopup.htb"
Delete "$INSTDIR\System\Moduli\Theme.htb"
Delete "$INSTDIR\System\Moduli\T9.htb"
Delete "$INSTDIR\System\Moduli\Setup.htb"
Delete "$INSTDIR\System\Moduli\Protection.htb"
Delete "$INSTDIR\System\Moduli\mp3.htb"
Delete "$INSTDIR\System\Moduli\Away.htb"
Delete "$INSTDIR\System\Moduli\Auto.htb"
Delete "$INSTDIR\System\Messaggi\quit.txt"
Delete "$INSTDIR\System\Messaggi\Away.txt"
Delete "$INSTDIR\System\Icons\voice.ico"
Delete "$INSTDIR\System\Icons\Thumbs.db"
Delete "$INSTDIR\System\Icons\stop.ico"
Delete "$INSTDIR\System\Icons\shuffle.ico"
Delete "$INSTDIR\System\Icons\repeatoff.ico"
Delete "$INSTDIR\System\Icons\prev.ico"
Delete "$INSTDIR\System\Icons\Plus.ICO"
Delete "$INSTDIR\System\Icons\play.ico"
Delete "$INSTDIR\System\Icons\pl.ico"
Delete "$INSTDIR\System\Icons\pause.ico"
Delete "$INSTDIR\System\Icons\open.ico"
Delete "$INSTDIR\System\Icons\next.ico"
Delete "$INSTDIR\System\Icons\mute.ico"
Delete "$INSTDIR\System\Icons\meno.ico"
Delete "$INSTDIR\System\Icons\main.ico"
Delete "$INSTDIR\System\Icons\Library\xp.icl"
Delete "$INSTDIR\System\Icons\Library\gnome.icl"
Delete "$INSTDIR\System\Icons\Edit.ico"
Delete "$INSTDIR\System\Grafica.txt"
Delete "$INSTDIR\System\Dll\WhileFix.dll"
Delete "$INSTDIR\System\Dll\UltraDock.dll"
Delete "$INSTDIR\System\Dll\sendkey.dll"
Delete "$INSTDIR\System\Dll\mOTFv3.dll"
Delete "$INSTDIR\System\Dll\mircustom.dll"
Delete "$INSTDIR\System\Dll\dcx.dll"
Delete "$INSTDIR\System\Background\wizard.bmp"
Delete "$INSTDIR\System\Background\Thumbs.db"
Delete "$INSTDIR\System\Background\main.bmp"
Delete "$INSTDIR\System\Background\image.bmp"
Delete "$INSTDIR\System\Background\9.gif"
Delete "$INSTDIR\System\Background\8.gif"
Delete "$INSTDIR\System\Background\7.gif"
Delete "$INSTDIR\System\Background\6.gif"
Delete "$INSTDIR\System\Background\5.gif"
Delete "$INSTDIR\System\Background\4.gif"
Delete "$INSTDIR\System\Background\3.gif"
Delete "$INSTDIR\System\Background\2.gif"
Delete "$INSTDIR\System\Background\15.gif"
Delete "$INSTDIR\System\Background\14.gif"
Delete "$INSTDIR\System\Background\13.gif"
Delete "$INSTDIR\System\Background\12.gif"
Delete "$INSTDIR\System\Background\11.gif"
Delete "$INSTDIR\System\Background\10.gif"
Delete "$INSTDIR\System\Background\1.gif"
Delete "$INSTDIR\System\Background\0.gif"
Delete "$INSTDIR\System\Aliases\Theme.ini"
Delete "$INSTDIR\System\Aliases\Protezioni.ini"
Delete "$INSTDIR\System\Aliases\mp3.ini"
Delete "$INSTDIR\System\Aliases\Docked.ini"
Delete "$INSTDIR\System\Aliases\Connection.ini"
Delete "$INSTDIR\System\Aliases\aliases.ini"
Delete "$INSTDIR\System\address.txt"
Delete "$INSTDIR\System\About.txt"
Delete "$INSTDIR\servers.ini"
Delete "$INSTDIR\mirc.ini"
Delete "$INSTDIR\mirc.exe"

Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
Delete "$DESKTOP\Starlight.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Starlight.lnk"

RMDir "$SMPROGRAMS\$ICONS_GROUP"
RMDir "$INSTDIR\System\Script"
RMDir "$INSTDIR\System\Moduli"
RMDir "$INSTDIR\System\Messaggi"
RMDir "$INSTDIR\System\Icons\Library"
RMDir "$INSTDIR\System\Icons"
RMDir "$INSTDIR\System\Dll"
RMDir "$INSTDIR\System\Background"
RMDir "$INSTDIR\System\Aliases"
RMDir "$INSTDIR\System"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd


Help me! :confused: