Old 16th June 2006, 00:17   #1
Zorbainpdx
Junior Member
 
Join Date: Jun 2006
Posts: 1
Setting read/write file attributes

In one of my projects, I need to copy over an .ini file from a CD to the install directory and write various install parameters like install path (driveletter) etc. to it.

Unfortunately,

WriteIniStr "$INSTDIR\updates.ini" "data" "driveletter" "$EXE_PATH\"

fails because the file I am trying to write to was copied from the CD in the first place using

CopyFiles /SILENT /FILESONLY "$EXEDIR\Data\Copy2HD\*.*" $INSTDIR\ 10000

By default, the copied file is Read Only since it came from a CD.

I need to be able to do one of two things --

1. Allow WriteIniStr to do it's thing even if the file is Read Only using an "AlwaysOverwrite +" or similar parameter

2. Before the WriteIniStr, I would like to change the Read Only status of the file. The "File Instructions" section of documentation does not mention anything that allows one to do this.

Thoughts ?

Thanks
Zorbainpdx is offline   Reply With Quote
Old 16th June 2006, 01:14   #2
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
Use SetFileAttributes to remove attributes before you call WriteIniStr.

To remove all attributes, the command would be:
SetFileAttributes "$INSTDIR\updates.ini" NORMAL
Comperio 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