Archive: Setting read/write file attributes


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


Use SetFileAttributes to remove attributes before you call WriteIniStr.

To remove all attributes, the command would be:
SetFileAttributes "$INSTDIR\updates.ini" NORMAL