Hello everyone,
any one can suggest me how get space required by installer?
The standard installer directory page of NSIS shows the Space required and the Space avaible. I would recreate that infos in a custom page.
For the avaible space I've used the function "UpdateFreeSpace" included in Starting from "NSIS\Examples\nsDialogs\welcome.nsi", but the for the Space required i din't found a solution. So can I retrieve this info or I should calculate it?
Thankss
Bruno
space required
14 posts
Get the size of every selected section using:
sorry but I've not understood
SectionGetSize can retrieve the amount size (in byte or Mb) of files and folder that NSIS will compress on the exe of the installer?
SectionGetSize can retrieve the amount size (in byte or Mb) of files and folder that NSIS will compress on the exe of the installer?
Thanksss I've followed your suggestion and I'v solved my question:
SectionGetSize ${MySectionFileToExtract} $0
IntOp $0 $0 + 100
SectionSetSize ${MySectionFileToExtract} $0
Thanksss
SectionGetSize ${MySectionFileToExtract} $0
IntOp $0 $0 + 100
SectionSetSize ${MySectionFileToExtract} $0
Thanksss
It retrieves the size in kilobytes of a given section when -uncompressed-. Note that this does not take into account things like filesystem overhead or NTFS compression, etc. But if drive space available is tight enough for such things to matter, the drive is definitely too full 😉Originally Posted by orecchionebruno View PostSectionGetSize can retrieve the amount size (in byte or Mb) of files and folder that NSIS will compress on the exe of the installer?
As MSG would say... search the forum;
Ok thankss and thanks for the thread that you post me
Thanksss I'm not sure to had understood. If SectionGetSize retrieves uncompressed size, I should not have any problems on any filesystem compresions or not?Originally Posted by Animaether View PostIt retrieves the size in kilobytes of a given section when -uncompressed-. Note that this does not take into account things like filesystem overhead or NTFS compression, etc. But if drive space available is tight enough for such things to matter, the drive is definitely too full 😉
I read your suggestion about "${DriveSpace} "$0\" "/D=F /S=G" $spaceAvailable ; G = GiB"Originally Posted by Animaether View PostAs MSG would say... search the forum;
http://forums.winamp.com/showthread....space+required
What the difference beetween ${DriveSpace} and GetDiskFreeSpaceEx?
This what I've used:
StrCpy $1 " byte"
System::Call kernel32::GetDiskFreeSpaceEx(tr0,*l,*l,*l.r0)
${If} $0 > 1024
${OrIf} $0 < 0
System::Int64Op $0 / 1024
Pop $0
StrCpy $1 "kb"
${If} $0 > 1024
${OrIf} $0 < 0
System::Int64Op $0 / 1024
Pop $0
StrCpy $1 "mb"
${If} $0 > 1024
${OrIf} $0 < 0
System::Int64Op $0 / 1024
Pop $0
StrCpy $1 "gb"
${EndIf}
${EndIf}
${EndIf}
SendMessage $FREESPACE ${WM_SETTEXT} 0 "STR:Space available: $0 $1"
Ciao
Bruno
Well, filesystem compression compresses the file when it's written away or as it's written away (depending on the FS). Let's say your application needs 13MB of space when not compressed, and the system only shows 12MB free. Your installer would then claim it can't be installed; but if you were to attempt install anyway, the filesystem might compress the files down to 8MB and it does fit.Originally Posted by orecchionebruno View PostThanksss I'm not sure to had understood. If SectionGetSize retrieves uncompressed size, I should not have any problems on any filesystem compresions or not?
Again, though, in any such situation I'd err on the side of caution and just tell the user that you don't care if they use compression, it's time for them to delete some stuff if they want your app installed 🙂
No real difference. DriveSpace uses the same API (GetDiskFreeSpaceEx) to get the free space. It just does some of the math bits for you and has some flags for getting total space/used space/free space.Originally Posted by orecchionebruno View PostI read your suggestion about "${DriveSpace} "$0\" "/D=F /S=G" $spaceAvailable ; G = GiB"
What the difference beetween ${DriveSpace} and GetDiskFreeSpaceEx?
Animaether, I think he meant to say: "I should not have any problems on any filesystem, regardless of the installer's compression." orecchionebruno, the answer to that question would be: Yes. SectionSetSize gets the harddrive space required for *installing* the section. It doesn't have anything to do with the size of the installer.Originally Posted by orecchionebruno View PostIf SectionGetSize retrieves uncompressed size, I should not have any problems on any filesystem compresions or not?
thanks Animaether and MSS
I'll consider any Animaether suggestions but for this specific situatation I'll consider only uncopress size because my data are only some mbytes and it's very hard that user has not some mb free. If not user will delete something.
thankss again
I'll consider any Animaether suggestions but for this specific situatation I'll consider only uncopress size because my data are only some mbytes and it's very hard that user has not some mb free. If not user will delete something.
thankss again
Hi Animaether and hi to everyone,Originally Posted by Animaether View PostNo real difference. DriveSpace uses the same API (GetDiskFreeSpaceEx) to get the free space. It just does some of the math bits for you and has some flags for getting total space/used space/free space.
I've followed Animaether suggestions because when I use the API as follow I'm not able to retrieve correct values:
System::Call kernel32::GetDiskFreeSpaceEx(tr0,*l,*l,*l.r0)
If I try to get free space on C:\ everything is correct, but if try in other drive the values are not correct. I'm sure that happens because I don't know wich parameter I should change so I had started using ${DriveSpace} but it happens something that I don't understand.
Using ${DriveSpace} I can get any value of any drives.
The problem happens when I try to compare some values. If I compare free space of C:\ or D:\ or H:\ (this is a USB pen) everything works but when I compare with my E:\ (it's a recovery partition) the conditions commands give me wrong value.
For example:
${GetRoot} $MYPATH1 $1
${DriveSpace} "$1\" "/D=F /S=B" $1
${GetRoot} $MYPATH2 $2
${DriveSpace} $MYPATH2
${If} "$MYPATH1 " U>= "$MYPATH2"
MessageBox MB_OK "PATH1 >= PATH2"
${Else}
MessageBox MB_OK "PATH1 < PATH2"
${EndIf}
If MYPATH1 and MYPATH2 is C:\, F:\ D:\, I obtain correct results but when is E:\ (the partition recovery) the value is apparently correct but the condition script doesn't work.
The problem should be on the variable format so I tried to see what happens if I do this but I get a negative value:
System::Int64Op $MYPATH1 * 1
Pop $MYPATH1
Any one have a suggestion to solve this problem?
Looks like you had posted this to a separate thread as well - see there 🙂
http://forums.winamp.com/showthread.php?t=321543 - "${DriveSpace} and some strange values "
http://forums.winamp.com/showthread.php?t=321543 - "${DriveSpace} and some strange values "
Hi Animaether, I'm sorry upper I made a mistake translating my variables. I correct the script, but the problem that I wrote is that happens.
${GetRoot} $MYPATH1 $1
${DriveSpace} "$1\" "/D=F /S=B" $FreeSpace1
${GetRoot} $MYPATH2 $2
${DriveSpace} "$2\" "/D=F /S=B" $FreeSpace2
${If} "$FreeSpace1" U>= "$FreeSpace2"
MessageBox MB_OK "PATH1 >= PATH2"
${Else}
MessageBox MB_OK "PATH1 < PATH2"
${EndIf}
_____
As Animaether wrote, this discussion continue here:
Thanksss
${GetRoot} $MYPATH1 $1
${DriveSpace} "$1\" "/D=F /S=B" $FreeSpace1
${GetRoot} $MYPATH2 $2
${DriveSpace} "$2\" "/D=F /S=B" $FreeSpace2
${If} "$FreeSpace1" U>= "$FreeSpace2"
MessageBox MB_OK "PATH1 >= PATH2"
${Else}
MessageBox MB_OK "PATH1 < PATH2"
${EndIf}
_____
As Animaether wrote, this discussion continue here:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
Thanksss
orecchionebruno, please stop posting in two threads at once. Use the other thread, not this one.
(And please don't reply to this post, either.)
(And please don't reply to this post, either.)