Skip to content
⌘ NSIS Forum Archive

Problem with Destination Folder's wright permission

4 posts

Sujay#

Problem with Destination Folder's wright permission

Hi,
i hv come accross one problem. i made a setup.exe for one application for windows. now i want to check that the destination folder user want to install is having the wright permissions or not. because at one machine there might not hving permission to wright in program files. I want to check this while installing the application and want to give one message to user to choose another folder.
thanks in advance.
-- Sujay
kichik#
You can use a method similar to that in the following thread:

Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


Though I'd use GetTempFileName so it won't overwrite any files.
Sujay#
thanks .
but can u send me any exmple srcipts to use this. i tried a lot but didnt understand how to do this.
Takhir#

!define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave
!insertmacro MUI_PAGE_DIRECTORY
Function OnDirLeave
ClearErrors
SetOutPath "$INSTDIR" ; what about IfError creating $INSTDIR?
GetTempFileName $1 "$INSTDIR" ; creates tmp file (or fails)
FileOpen $0 "$1" "w" ; error to open?
FileWriteByte $0 "0"
IfErrors notPossible possible

notPossible:
RMDir "$INSTDIR" ; removes folder if empty
MessageBox MB_OK "Not able to write into this directory!"
Abort
possible:
FileClose $0
Delete "$1"
FunctionEnd