Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 6th January 2002, 18:05   #1
Jubijub
Junior Member
 
Join Date: Jan 2002
Location: Lyon, France
Posts: 14
Send a message via ICQ to Jubijub Send a message via AIM to Jubijub Send a message via Yahoo to Jubijub
Question Problem with the $INSTDIR and registry

I'm currently makin a mappack for CS.

I need to know the exact path of the cstrike directory.

So I've coded it that way :

Quote:
;DIF.nsi
;
;Install script by Jubijub
;
;
;
;init numero de version
!define VER_MAJOR 1
!define VER_MINOR 1

;Nom de l'installer
Name "DIF-Mappack v${VER_MAJOR}.${VER_MINOR}"
Caption "-=[D.I.F]=- Mappack v${VER_MAJOR}.${VER_MINOR} by Jubijub"
;Nom du fichier
OutFile "DIF-mappack_v${VER_MAJOR}.${VER_MINOR}.exe"

;parametres generaux
Icon main.ico
MiscButtonText "Retour" "Suivant" "Annuler" "Fermer"
;Composants
EnabledBitmap d:\test\three-check.bmp
DisabledBitmap d:\test\three-nocheck.bmp
AutoCloseWindow false
ShowInstDetails show
ShowUninstDetails show
SetCompress auto
SetDatablockOptimize on
CRCCheck on
BGGradient 000000 e21c00 FFFFFF
InstallColors e21c00 000000
InstProgressFlags smooth colored
SetOverwrite ifnewer
DirShow hide
DirText ""

;detection rep half-life
section ""
ReadRegStr $INSTDIR HKLM "software\Valve\Half-Life" InstallPath
SectionEnd

;licence
LicenseText "Vous devez accepter ce qui suit avant de continuer:"
LicenseData license.txt
;caption
ComponentText "Ceci installera le pack -=[D.I.F]=- dans le repertoire de Counter-strike"
DetailsButtonText "Details"
CompletedText "Operation terminée avec succès"

InstallDir $INSTDIR
InstallDirRegKey HKLM SOFTWARE\DIF "Install_Dir"


;INSTALL
; Section principale
Section "Maps (requis)"
SetOutPath $INSTDIR\cstrike
file d:\test\*.wad
SetOutPath $INSTDIR\cstrike\maps
file d:\test\maps\*.*
;SetOutPath $INSTDIR\cstrike\sound
;SetOutPath $INSTDIR\cstrike\gfx
WriteRegStr HKLM SOFTWARE\DIF "Install_Dir" "$INSTDIR\cstrike"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DIF" "DisplayName" "DIF Mappack (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DIF" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteUninstaller "uninstall.exe"
SectionEnd

; section bonus
Section "Bonus sons kevlar+NV"
SetOutPath $INSTDIR\cstrike\sound\items
file d:\test\sounds\items\*.wav
SectionEnd

; section uninstall
Section "Uninstall"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DIF"
DeleteRegKey HKLM SOFTWARE\DIF
Delete $INSTDIR\cstrike\porno.wad
Delete $INSTDIR\cstrike\cs_thunder.wad
Delete $INSTDIR\cstrike\maps\cs_beirut.bsp
Delete $INSTDIR\cstrike\maps\cs_beirut.txt
Delete $INSTDIR\cstrike\maps\cs_docks_v1.bsp
Delete $INSTDIR\cstrike\maps\cs_docks_v1.txt
Delete $INSTDIR\cstrike\maps\cs_thunder.bsp
Delete $INSTDIR\cstrike\maps\cs_vineyard.bsp
Delete $INSTDIR\cstrike\maps\cs_vineyard.txt
Delete $INSTDIR\cstrike\maps\de_dust4ever.bsp
Delete $INSTDIR\cstrike\maps\de_dust4ever.txt
Delete $INSTDIR\cstrike\maps\de_kaktus.bsp
Delete $INSTDIR\cstrike\maps\de_kaktus.txt
Delete $INSTDIR\cstrike\maps\de_rotterdam.bsp
Delete $INSTDIR\cstrike\maps\de_rotterdam.txt
Delete $INSTDIR\cstrike\maps\pa_kruncinator(fr).txt
Delete $INSTDIR\cstrike\maps\pa_krunchinator.bsp
Delete $INSTDIR\cstrike\maps\pa_krunchinator.txt
Delete $INSTDIR\cstrike\maps\pa_krunchinator_readme.txt
Delete $INSTDIR\cstrike\maps\pa_krunchinator_readme(fr).txt
Delete $INSTDIR\cstrike\sound\items\equip_nvg.wav
Delete $INSTDIR\cstrike\sound\items\kevlar.wav
Delete $INSTDIR\cstrike\sound\items\nvg_off.wav
Delete $INSTDIR\uninstall.exe
Delete $INSTDIR\cstrike\uninstall.exe
SectionEnd

; eof
I had to disable the directory selection page, because when it was enabled, the detected path (that works) wasn't displayed in the editbox...and the browse function was of no use, because whatever directory you choosed, the mappack installed in the righ directory, the $INSTDIR\cstrike.

I would like to turn this feature back on, so that people could be able to check if the detected path is right or not
Jubijub is offline   Reply With Quote
Old 6th January 2002, 19:34   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
You should replace this:

code:
;detection rep half-life
section ""
ReadRegStr $INSTDIR HKLM "software\Valve\Half-Life" InstallPath
SectionEnd



with this:
code:
InstallDirRegKey HKLM "software\Valve\Half-Life" "InstallPath "


Notice that this part of the code is not located in any section.
kichik is offline   Reply With Quote
Old 6th January 2002, 21:02   #3
Jubijub
Junior Member
 
Join Date: Jan 2002
Location: Lyon, France
Posts: 14
Send a message via ICQ to Jubijub Send a message via AIM to Jubijub Send a message via Yahoo to Jubijub
InstallDir $INSTDIR
InstallDirRegKey HKLM SOFTWARE\DIF "Install_Dir"

thanks, my parameters were wrong

yours are too

-->no "" for the string you want to read...

InstallDirRegKey HKLM "software\Valve\Half-Life" InstallPath

et not

InstallDirRegKey HKLM "software\Valve\Half-Life" "InstallPath"
Jubijub is offline   Reply With Quote
Old 7th January 2002, 10:05   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
You do need quotes if you have spaces in the name. I accidently put space after InstallPath, that is what was wrong.

The InstallDir $INSTDIR is useless. With InstallDir you should set the default install dir if no other found by InstallDirRegKey.

So it should be:
code:
InstallDir "C:\Half-Life"
InstallDirRegKey HKLM "software\Valve\Half-Life" "InstallPath"

kichik is offline   Reply With Quote
Old 7th January 2002, 17:21   #5
Jubijub
Junior Member
 
Join Date: Jan 2002
Location: Lyon, France
Posts: 14
Send a message via ICQ to Jubijub Send a message via AIM to Jubijub Send a message via Yahoo to Jubijub
Arrow

I realised that my instdir system was not implemented...

that's ok now...I've tested with a fake key : the program follow the changes, and if I delete the key, the default path is activated...
Jubijub is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump