Archive: Hard Drive Space


Hard Drive Space
Stupid question but... if the person using the installer doesn't have enough disk space will the installer notify them or just not install the files? Thanks.


You will get an error message.


The next/install button will be grayed out which means the user won't be able to start the installation. There is no error message because you can't click the next button.


Hi,

I would like to know if there is way that an error message could be displayed if the Install Directory is full ?

I understand that currently if the install directory is full, the install button is grayed out. However, I am also required to display an error message informing the user that the Install Directory/Hard Disk is full.

If I am not mistaken, I may need to configure the MUI/UMUI NSIS codes for this. Are there any leads on how to configure these codes?


Would appreciate any advice on this.

Thanks


You can create a Function .onVerifyInstDir and put a MessageBox in there, but you'll also have to find a way to check if there is no space left.

This could either be done by checking the path itself, or by checking some text or something on the NSIS dialog.

-Stu


You can use GetInstDirError for that.


Cool didn't know about that :o

-Stu


Hi,

Based on your advices and references, I have found a way on actually displaying an error message for an invalid installation directory or insufficient HD Space for the installed path.

For this, we have to slightly modify the UMUI.nsh file (Ultra Moden UI) or the Systems.nsh (Modern UI) within the NSIS Install directory.

Inside these .nsh files, find the macro MUI_PAGE_DIRECTORY function and add in the extra codes as highlighted in bold below;
!macro MUI_PAGE_DIRECTORY

!verbose push
!verbose ${MUI_VERBOSE}

!insertmacro MUI_PAGE_INIT

!insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}DIRECTORYPAGE

!insertmacro MUI_DEFAULT MUI_DIRECTORYPAGE_TEXT_TOP ""
!insertmacro MUI_DEFAULT MUI_DIRECTORYPAGE_TEXT_DESTINATION ""

PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}directory

PageCallbacks ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.DirectoryPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.DirectoryShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.DirectoryLeave_${MUI_UNIQUEID}
PageCallbacks "" "" dirLeave


Caption " "

DirText "${MUI_DIRECTORYPAGE_TEXT_TOP}" "${MUI_DIRECTORYPAGE_TEXT_DESTINATION}"

!ifdef MUI_DIRECTORYPAGE_VARIABLE
DirVar "${MUI_DIRECTORYPAGE_VARIABLE}"
!endif

/* Disable the DirVerify function that disables the 'Next' / 'Install' button for Invalid Path or File Size */
;!ifdef MUI_DIRECTORYPAGE_VERIFYONLEAVE
DirVerify leave
;!endif


PageExEnd

Function dirLeave
GetInstDirError $0
${Switch} $0
${Case} 0
goto FINNISH_INST_DIR_PAGE
${Break}
${Case} 1
goto INVALID_INSTALL_DIR_PATH
Abort
${Break}
${Case} 2
goto INVALID_INSTALL_DIR_SPACE
Abort
${Break}
${EndSwitch}


INVALID_INSTALL_DIR_PATH:
MessageBox MB_OK|MB_ICONSTOP "Error: Invalid Installation Directory Path !"
Abort

INVALID_INSTALL_DIR_SPACE:

${Default} # Default at English language
MessageBox MB_OK|MB_ICONSTOP "The selected installation directory does not have adequate space !"
Abort

FINNISH_INST_DIR_PAGE:
FunctionEnd



Based on the codes above and reference as provided by Kichik, we have to disable (comment) the !ifdef MUI_DIRECTORYPAGE_VERIFYONLEAVE command to prevent the Install button from being grayed out in the event of an invalid installation path/insufficient HD Space. In other words, the 'DirVerify leave' command must always be executed .

From these we add the PageCallbacks "" "" dirLeave callback function that checks for an invalid installation path/insufficient HD Space.

From the codes above, in the install directory page, if user points to an invalid install path or to an install path with in-adequate HD space, an error message is displayed to user if user clicks on the Install/Next button, instead of having the button grayed out, as would be normally seen.

I hope the above codes helps.

Special Thanks and appreciation to Afrow and Kichik for your help and advice.