Old 7th December 2007, 17:11   #1
Fightin_Foo
Junior Member
 
Join Date: Nov 2007
Location: Ohio
Posts: 49
Send a message via AIM to Fightin_Foo
Get File Version at Compile

Does anybody know if it is possible to get the version of a file at compile time? Hopefully storing it in a variable or constant. I would like to do my version compare in the .onInit function, so if the user is trying to install an old version on top of a new version it will stop them asap.

From there to here,
from here to there,
funny things
are everywhere.

Dr. Seuss
"One Fish Two Fish Red Fish Blue Fish"
Fightin_Foo is offline   Reply With Quote
Old 7th December 2007, 18:04   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Would be bette during in "runtime"..IfFileExists.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 7th December 2007, 18:14   #3
Fightin_Foo
Junior Member
 
Join Date: Nov 2007
Location: Ohio
Posts: 49
Send a message via AIM to Fightin_Foo
I have no problems getting the version of the file that is actually installed. I am having troubles getting the version of the file that is bundled in the installer. I came up with the idea of setting a variable with the version of the bundled file on compile. That way I can get it set when the installer is built and use it where I need to.

From there to here,
from here to there,
funny things
are everywhere.

Dr. Seuss
"One Fish Two Fish Red Fish Blue Fish"
Fightin_Foo is offline   Reply With Quote
Old 7th December 2007, 18:32   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
http://nsis.sourceforge.net/Invoking...n_compile-time

Stu
Afrow UK is offline   Reply With Quote
Old 7th December 2007, 18:36   #5
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 571
Quote:
Does anybody know if it is possible to get the version of a file at compile time?
GetDLLVersionLocal might do what you want:

http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.6
pengyou is offline   Reply With Quote
Old 7th December 2007, 20:54   #6
Fightin_Foo
Junior Member
 
Join Date: Nov 2007
Location: Ohio
Posts: 49
Send a message via AIM to Fightin_Foo
Thanks Afrow UK that worked great!

From there to here,
from here to there,
funny things
are everywhere.

Dr. Seuss
"One Fish Two Fish Red Fish Blue Fish"
Fightin_Foo is offline   Reply With Quote
Old 8th December 2007, 12:15   #7
Backland
Senior Member
 
Join Date: Sep 2006
Posts: 150
One suggestion that might save you needing an extra script to get this at runtime:

why dont you extract the new file (at runtime) to the temp directory and get the file versions and compare them?
Backland is offline   Reply With Quote
Old 8th December 2007, 13:10   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Having the version before hand will save you having to extract the files.

Stu
Afrow UK is offline   Reply With Quote
Old 8th December 2007, 13:43   #9
Backland
Senior Member
 
Join Date: Sep 2006
Posts: 150
Considering that the installer already extract quite a few files to the plugins dir, one more file for version checking wouldn't add considerable overhead.

The compile time method doesnt add much either, but I would (personally) do it at runtime and have a simpler script.
Backland is offline   Reply With Quote
Old 8th December 2007, 16:09   #10
ClayDowling
Junior Member
 
Join Date: Nov 2005
Location: Flint, MI
Posts: 21
Send a message via AIM to ClayDowling
If you're wanting to save yourself the trouble I just included getversion.nsi in the Registration plugin (see the wiki in Plugins). It's written for you and creates a macro you can insert directly into your compiler. An example of how to use it is also included.
ClayDowling 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