Also, I'm not using MUI. I just want to require that the installation directory does not exist.
I've googled, searched this forum and the closest I came was this on stackoverflow.
Any ideas? Thanks.
How to require a non-existent installation directory?
6 posts
MUI is not required, just use Page Directory "" "" MyLeaveFunction...
You didn't bother explaining too precisely what you're trying to achieve in practice, but maybe something like this?
InstallDir $PROGRAMFILES\MyAppDir
Page directory "" "" CheckInstDir
Function CheckInstDir
IfFileExists "$INSTDIR\*.*" 0 +3
MessageBox MB_OK|MB_ICONSTOP "$INSTDIR already exists, select a different dir."
Abort
FunctionEnd Error msg will be displayed if user selects an existing path that ends with \MyAppDir.Indeed that does work. Thank you very much. I'll point this out on SO.Originally Posted by Anders View PostMUI is not required, just use Page Directory "" "" MyLeaveFunction...
That's exactly what I did, though I left off the \*.* on the IfFileExists. Is there a reason to use your version? I've tested my version and it appears to work as I want (calls Abort if the directory exists, doesn't if it doesn't).Originally Posted by aerDNA View PostYou didn't bother explaining too precisely what you're trying to achieve in practice, but maybe something like this?
Error msg will be displayed if user selects an existing path that ends with \MyAppDir.InstallDir $PROGRAMFILES\MyAppDir Page directory "" "" CheckInstDir Function CheckInstDir IfFileExists "$INSTDIR\*.*" 0 +3 MessageBox MB_OK|MB_ICONSTOP "$INSTDIR already exists, select a different dir." Abort FunctionEnd
No, it's just a habit. It would matter if you needed to distinguish a file from a dir but in this case you don't.
Edit: there's the possibility that an actual file exists with same path but in that case the 'Install' button will be disabled anyway.
Edit: there's the possibility that an actual file exists with same path but in that case the 'Install' button will be disabled anyway.