Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 14th April 2005, 15:06   #1
t44
Guest
 
Posts: n/a
Wrong installation path when updating

I have created a setup which correctly installs my application. The application's main executable is located in a "bin" folder below the installation directory. For example, after installation, the installation directory looks like this:

{InstallDir}\bin\myapp.exe
{InstallDir}\data\datafile.dat

So far so good.

The problem is, that when I start the setup kit again, e.g. to update my app, the installer proposes "{InstallDir}\bin" as the installation directory.

Where does it get this path from and how can I correct it?

Thanks a lot,
Martin
  Reply With Quote
Old 14th April 2005, 16:11   #2
glory_man
Senior Member
 
Join Date: Sep 2004
Location: Mogilev (Belarus)
Posts: 372
Did you use InstallDir, InstallDirRegKey functions in your script?
glory_man is offline   Reply With Quote
Old 14th April 2005, 21:34   #3
tinu44
Junior Member
 
Join Date: Sep 2002
Posts: 5
The script was generated using HM NIS Editor wizard.

All I did was to add (for example) an exe file which goes to {InstallDir}\bin and a data file which goes to {InstallDir}\data.

The installation works OK. But when I start the setup again (immediately after installation), it proposes {InstallDir}\bin as the installation directory.

I can post the script tomorrow.

Thanks
tinu44 is offline   Reply With Quote
Old 15th April 2005, 06:58   #4
tinu44
Junior Member
 
Join Date: Sep 2002
Posts: 5
Here's the script (generated with HM NIS's wizard).
Attached Files
File Type: nsi nsis_test.nsi (3.6 KB, 99 views)
tinu44 is offline   Reply With Quote
Old 15th April 2005, 09:58   #5
glory_man
Senior Member
 
Join Date: Sep 2004
Location: Mogilev (Belarus)
Posts: 372
Try in Section -Post change
code:
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\bin\myapp.exe"


on
code:
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR"

glory_man is offline   Reply With Quote
Old 15th April 2005, 11:37   #6
tinu44
Junior Member
 
Join Date: Sep 2002
Posts: 5
Thanks for your help, your solution works.

But since my application is already installed and I am now in the process of creating the setup for a newer version of the app I had to solve it differently.

What I'm doing now is to check $INSTDIR in .onInit and if it ends with "\bin", I take its parent directory instead.

In case anyone is interested, here's the code I used for that:

code:

; call this from .onInit
Function CheckInstDir
Push $INSTDIR
Push "\bin"
Call StrStr
Pop $0
StrCmp $0 "\bin" lbl_upd lbl_inst
lbl_upd:
; app is already installed, update it
Push $INSTDIR
Call GetParent
Pop $INSTDIR
lbl_inst:
FunctionEnd



The functions StrStr and GetParent can be found in the NSIS help file (Appendix C).
tinu44 is offline   Reply With Quote
Old 15th April 2005, 12:29   #7
glory_man
Senior Member
 
Join Date: Sep 2004
Location: Mogilev (Belarus)
Posts: 372
What are you want to do?
Now, by default, your installer place files in "c:\program files\My application\bin", where "c:\program files\My application\"=$INSTDIR -> this path selected by user. This location ($INSTDIR) store in regestry.
However, if user select "c:\programm\myapp\bin" (this is value of $INSTDIR) path to install programm your files will be place in "c:\programm\myapp\bin\bin". So if your take parent dir location of files will be "c:\programm\myapp".
glory_man 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