Old 4th June 2018, 08:20   #1
alibabavl64
Junior Member
 
Join Date: Apr 2013
Posts: 27
Default Install folder

I made an installer, let say InstApp1

InstallDir "C:\Path1"


For a new version of installer i made this:

Copied (Select All->CTRL+C) old installer instructions;
generate a new NSIS file, "Paste" in it instructions.
Modified what i need..Version and PATH:

InstallDir "C:\Path2".

Saved
generate installer, launch.

No metter on what PC launch installer, the default path still remain "C:\Path1".

Why happend this?

"C:\Path1" not found in NSIS source of second installer.
alibabavl64 is offline   Reply With Quote
Old 4th June 2018, 13:29   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,843
InstallDirRegKey?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 4th June 2018, 15:22   #3
OffTheMapTravel
Junior Member
 
Join Date: May 2018
Posts: 23
What system are you on?
OffTheMapTravel is offline   Reply With Quote
Old 4th June 2018, 18:58   #4
alibabavl64
Junior Member
 
Join Date: Apr 2013
Posts: 27
NSIS is installed about 3 years on XP SP3. And working well.
Installer tested on W7-64, XPSP3, W10-64..

On both the same wrong default install dir.


InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""

!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\LaunchPRG.exe"

Section -Post
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\LaunchPRG.exe
alibabavl64 is offline   Reply With Quote
Old 4th June 2018, 19:02   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,843
The key path and/or name used in InstallDirRegKey must be different for different products because it overrides $InstDir set by InstallDir before .onInit.

Comment out the InstallDirRegKey line and see if that fixes the issue.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 4th June 2018, 19:09   #6
alibabavl64
Junior Member
 
Join Date: Apr 2013
Posts: 27
[...]

I will try to comment the line and i will tell you.

I saw now: If installed first version and not uninstalled, this key remain and became next Installdir...
I will erase the line.

Thank you
alibabavl64 is offline   Reply With Quote
Old 4th June 2018, 19:51   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,843
Ideally you should point InstallDirRegKey to your applications unique Uninstall entry.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th June 2018, 09:48   #8
alibabavl64
Junior Member
 
Join Date: Apr 2013
Posts: 27
Please, more. You "lost" me.

Anyway, i commented the line as you told me and the default install path is showed correctly.

Last edited by alibabavl64; 5th June 2018 at 10:51.
alibabavl64 is offline   Reply With Quote
Old 5th June 2018, 20:10   #9
Nutzzz
Junior Member
 
Join Date: May 2007
Location: Orange County, CA, U.S.A.
Posts: 49
You probably already know this, but what @Anders was saying:

If your installer adds the uninstaller to the Add/Remove Programs (e.g., in reg key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LaunchPRG)

...then you would already be doing this on a new install:
code:
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LaunchPRG" "InstallLocation" "$\"$INSTDIR$\""


[Which is what he meant by "applications unique Uninstall entry."]

Since you have to set that value anyway for the uninstaller, you should just use that for your upgrades:
code:
InstallDir "$PROGRAMFILES64\LaunchPRG" # set default
InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LaunchPRG" "InstallLocation" # get path for upgrade



You want to ensure the directory still exists before treating it as an upgrade. And of course you would make sure your uninstaller deletes that key.
Nutzzz is offline   Reply With Quote
Old 6th June 2018, 12:13   #10
alibabavl64
Junior Member
 
Join Date: Apr 2013
Posts: 27
Understud now. Thank you.
alibabavl64 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast 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