How to get file size of included files automatically
Hi,
we have an installer to install a hardware driver on several windows platforms.
We were asked to provide an option to just extract ALL driver files.
A check should be included to make sure that there is enough free disk space at the destination.
I was searching quite a bit, but did not find something like DLLVersionLocal for GetFilesizeLocal.
So I came up with the following:
# Unixtools from http://unxutils.sourceforge.net/
>!define DRIVERS "${PROJECTDIR}driver"
>!define EFS_INCLUDE "${PROJECTDIR}driver\DrvExtrSize.nsh"
>!SYSTEM '(echo.|set /p =!define EXTRACTFILESIZE ) >${EFS_INCLUDE}'
>!SYSTEM '${UNIXTOOL}\du -s -k ${DRIVERS}| ${UNIXTOOL}\cut -f1 >>${EFS_INCLUDE}'
>!include ${EFS_INCLUDE}
:
:
:
>Section Extract XTR
AddSize${EXTRACTFILESIZE}
>SectionEnd
>
This will create an include file with a define for the filesize at compile time and can be later used for comparison with the free disk space.If there's a smarter solution I'd be glad to learn.