Old 19th January 2006, 10:47   #1
Sujay
Junior Member
 
Join Date: Dec 2005
Location: Mumbai
Posts: 5
Exclamation 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
Sujay is offline   Reply With Quote
Old 19th January 2006, 18:02   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You can use a method similar to that in the following thread:

http://forums.winamp.com/showthread....ite+permission

Though I'd use GetTempFileName so it won't overwrite any files.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 20th January 2006, 04:18   #3
Sujay
Junior Member
 
Join Date: Dec 2005
Location: Mumbai
Posts: 5
thanks .
but can u send me any exmple srcipts to use this. i tried a lot but didnt understand how to do this.
Sujay is offline   Reply With Quote
Old 20th January 2006, 06:14   #4
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
code:

!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

Takhir is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump