You are here

PortableApps.com Installer Space Calculation

11 posts / 0 new
Last post
Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
PortableApps.com Installer Space Calculation

I know the installer subtracts the deleted App folder in its space calculation and refuses to run if there isnt enough space available. However, today I updated my Turborisk on my 1 gb drive and it said:

Space required: 27.0 MB
Space available: 18.2 MB

It installed correctly after I hit Install but it still looked weird to me. Internally, the numbers must add up as it didnt gave me a "not enough space on drive"-warning. Maybe there is something one could do to display the numbers correctly?

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
Special calculation

Those figures are generated by NSIS and we can't modify them. However, when upgrading an app the space of the old version s freed up, and so there's a calculation there which takes into account the files which will be deleted before installing the new files - generally AppNamePortable.exe, help.html, App and Other. This makes it work correctly, but making the numbers correct isn't feasible (it might be possible to a certain degree with altering the strings via shell functions and things like that, but it still wouldn't work as it should due to the time when the function gets notified).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
ok

I didnt know those numbers displayed were done by NSIS, I just knew John had a special calculation in place.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

John T. Haller
John T. Haller's picture
Offline
Last seen: 1 hour 56 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Can't Do Ahead of Time, Maybe Custom Function?

We can't set it ahead of time to remove the space used by the current app from the Space Required field because we don't know if it's an upgrade or not until they pick a directory. I seem to recall there being a way to have NSIS do a custom function when the user changes the directory, at which point we could re-do that required space bit based on whether it was an upgrade. I can't find the info on it at the moment, but if someone can find it, I'll be happy to add the feature in.

Sometimes, the impossible can become possible, if you're awesome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
Just what we've got

As far as I'm aware, all that there is is the custom function to allow or disallow installation, which gets told how much free space there is, and that's what you already use. I'm not aware of any way of telling NSIS how much free space there is.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

John T. Haller
John T. Haller's picture
Offline
Last seen: 1 hour 56 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
No no

There isn't built in. But there is a way to hook a custom function to a control in a form (directory selection in our case) and when it's interacted with, trigger a custom function (in our case, a function that would figure out if it's an upgrade or not and modify the Space Required window control directly).

Sometimes, the impossible can become possible, if you're awesome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
Ah

With InstallOptions or nsDialogs that's possible, but for the core ones unless MUI supports it - which I don't believe it does - it's not possible.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

xuesheng
Offline
Last seen: 11 months 1 week ago
Joined: 2008-03-21 15:34
I think you mean the

I think you mean the .onVerifyInstDir callback which enables control over whether or not an installation path is valid for your installer. This code will be called every time the user changes the install directory.

See the NSIS Users Manual for further details:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.7.2.1.10

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
Used

That's what is currently used. The question currently is whether the space required or space available values can be changed (and I believe they can't).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

John T. Haller
John T. Haller's picture
Offline
Last seen: 1 hour 56 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Nope

We don't use that function. That function is a LIVE function and is called every time the install directory changes, which is what we want. From there, we could then manually update the Space Required field based on whether it is an upgrade. Basically we could take the example code and check for the existence of $INSTDIR\App\AppInfo\AppInfo.ini as a relatively low-cost check. If it exists, we update the field with "Space Required: $INSTALLSIZE-$CURRENTSIZE". If it doesn't, we update the field with "Space Required: $INSTALLSIZE".

Sometimes, the impossible can become possible, if you're awesome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
Yep

Sorry, yeah, we use a callback function. If you want to try doing this, I think it'd be better to put an "approximately" in there, as we're not going to be able to tell without examining it how much we can save, and that would be too slow.

Then I suppose you can edit the control's text. I've never done that directly in NSIS code...

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Log in or register to post comments