Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 22nd August 2006, 03:59   #1
jfellis
Junior Member
 
Join Date: Nov 2004
Posts: 8
Determining Extracted File Size

Hi,

Is there any way to determine how much space will be required for a zip file to be successfully extracted. I have a zip file on a CD that I would like to extract and install on the hard drive IF there is enough space on the hard drive. I would like to display the correct extracted space requirement on the installer. I can only get the size of the zipped file, so how do I know if there will be enough space when I unzip it?

Thanks. Great product and great Forum!!
jfellis is offline   Reply With Quote
Old 22nd August 2006, 23:57   #2
JasonFriday13
Senior Member
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: Taranaki, New Zealand
Posts: 400
If you are using the ZipDll plugin, check the help file for a 'getzipsize' or similar function, and execute it in .oninit. To add that size to a section, use AddSize.

Section blah
AddSize "$0" ; $0 is the variable you
; stored the size of the zip in.
SectionEnd

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 23rd August 2006, 04:41   #3
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
If you use a 3rd party command line zip tool like 7-zip or Info-Zip, you might find a function to get the size (although maybe not directly).

For example, 7zip does not have anthing that just returns the size, but if you issue this command:
7za l archive.zip > c:\temp\list.txt

you'll get the contents of the archive "archive.zip" to the file "C:\temp\list.txt") in which the the 2nd to the last line contains the total size (in bytes) of the zip archive. Once you have that, you could write a function that would open the file and read the info out of it. (Check the plugins page for some functions to help you.)

Other zip utilities might offer something similiar.

Or, if you are the one packing the zip file in the first place, just unzip the archive on your own to figure out its size and then add the size your installation as JasonFriday13 suggested.
Comperio 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