- NSIS Discussion
- Version checking
Archive: Version checking
galil
19th January 2003 13:03 UTC
Version checking
I need to implement a following feature for my installer:
Check for version string in registry, and if
a)it's < than current (old version of me detected) - do normal install (simply overwrite old files).
b)not found (I wasn't installed before) - do backup and proceed with install.
c)it's the same as current (user already has me installed) - start with uninstall page instead.
I quess the check has to be done using user variables? But how do they work? I kinda tried to stay away from that stuff before. Or is there a simple way?
And I don't know how to put all this into one function. Should it be .onGUIInit ? And how to call those different types of install?
Uhh...my head hurts :))
Sunjammer
19th January 2003 13:18 UTC
Once you have read your version string from the registry you might find this useful: http://nsis.sourceforge.net/archive/viewpage.php?pageid=57
galil
23rd January 2003 03:25 UTC
Ok, here's my yet another problem:
I made a script to check for a correct version
Function .onVerifyInstDir
IfFileExists $INSTDIR\exefile.exe exe_found
Abort
exe_found:
Push "$INSTDIR\exefile.exe"
Call FileSize
Pop $0
StrCmp $0 2748447 exe_ok
Abort
exe_ok:
IfFileExists $INSTDIR\Data\data.dat dat_found
Abort
dat_found:
FunctionEnd
It works, but I'm not quite happy how. The check works in the InstallationFolder window. It grays out the "install" button, but before that it lets the user to select wrong folder. So it could be pretty confusing. I'd like it to prevent the user from selecting the wrong dir somehow. Any help?
kichik
23rd January 2003 09:46 UTC
It does prevent him from the selecting the wrong directory. It will only allow the user to click install when he points to the directory where exefile.exe file is 2748447 bytes and data.dat exists. What's wrong with that?
galil
23rd January 2003 11:36 UTC
Nothing wrong, it just could confuse the user. I wanted to "gray out" the ok button of the "browse for folder" window (like Windows does, when you don't select the correct folder).
Oh well. I quess I'm just too picky, right?
kichik
23rd January 2003 11:40 UTC
But it does. When you use Abort from .onVerifyInstDir it grays out the OK button (next/install in this case).
galil
23rd January 2003 12:11 UTC
No no, I had in mind that folder-tree window that pops up when you click browse.
kichik
23rd January 2003 12:13 UTC
Oh... That can be done. Add it to the feature requests in SF (http://nsis.sf.net/ -> Project Page).
galil
23rd January 2003 12:31 UTC
I'd do it, if I only could describe it in short and using tech speech :o
My babblings about "graying out some stuff in that pops ups" won't make much sense I guess...
Though this could be really usefull (maybe not that common, but still usefull) feature, imho.
virtlink
24th January 2003 13:58 UTC
There's nothing wrong with your babbelings :), it's just that KiCHiK never reads a post completely. It happens most of the time ;)!