NSIs check disk space is insufficient

Source: Internet
Author: User

NSIs check disk space is insufficient, reproduced from: http://stackoverflow.com/questions/989172/how-can-i-check-free-space-during-a-nullsoft-silent-install

! Include filefunc. nsh <br/>! Insertmacro drivespace </P> <p> name "checkfreespace" <br/> OUTFILE "C:/checkfreespace.exe" </P> <p> installdir C: /tmp/checkfreespace </P> <p> page instfiles </P> <p> section "install_section" install_section_id <br/> call checkfreespace </P> <p> createdirectory $ instdir <br/> setoutpath $ instdir <br/> file "C: /installme. bat "</P> <p> writeuninstaller" $ instdir/uninstall.exe "</P> <p> detailprint" installation successful. "<br/> sectionend </P> <p> section" Uninstall "</P> <p> rmdir/R" $ instdir "</P> <p> sectionend </P> <p> function checkfreespace </P> <p> var/Global installsize <br/> var/Global adjustedinstallsize <br/> var/Global freespace <br/> VaR /Global instdrive </P> <p>; verify that we have sufficient space for the install </P> <p>; sectiongetsize returns the size of each section in kilobyte. <br/> sectiongetsize $ {install_section_id} $ installsize </P> <p>; adjust the required install size by 10 MB, as a minimum amount <br/>; of free space left after installation. <br/> intop $ adjustedinstallsize $ installsize + 10240 </P> <p>; compute the drive that is the installation target; the <br/>; $ {drivespace} Macro will not accept a path, it must be a drive. <br/> strcpy $ instdrive $ instdir 3 </P> <p>; compute drive space free in kilobyte <br/>$ {drivespace} $ instdrive "/D = f/S = K" $ freespace </P> <p> detailprint "determined installer needs $ adjustedinstallsize KB ($ installsize KB) while $ freespace KB is free "</P> <p> intcmp $ adjustedinstallsize $ freespace spaceok </P> <p> MessageBox mb_ OK | mb_iconstop" insufficient space for installation. please free space for installation directory $ instdir and try again. "<br/> detailprint" insufficient space for installation. installer needs $ adjustedinstallsize kb, but freespace is only $ freespace kb. "<br/> abort" insufficient space for installation. "</P> <p> spaceok: <br/> detailprint" installation target space is sufficient "</P> <p> functionend <br/>

Memo
The end

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.