cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gmpk82
Level 5

failing to remove the file with read-only attribute

hi
my installer is failing to remove one file during uninstallation, which is having "read only" attribute.

Actually this file needs to be set as "read only" its attributes must be set as read only, so before packaging I am modifying its attributes to readonly using PERL scripts, and then building my Setup.exe. is it right way or do I need to set "Read-only" manually using installshield option : file properties-> Override system attributes-> selecting check box of "Read-only".

can someone please suggest me to fix "removing read-only file during uninstall"
Labels (1)
0 Kudos
(1) Reply
gmpk82
Level 5

I used below piece of code as work around and got it done.


if (GetFileInfo( szErrPropFilePath, FILE_ATTRIBUTE, nvResult, svResult )=0) then
if (nvResult = FILE_ATTR_NORMAL) then
//nothing
else
if (FILE_ATTR_READONLY & nvResult) then
if (SetFileInfo( szErrPropFilePath, FILE_ATTRIBUTE, FILE_ATTR_NORMAL, "" ) < 0) then
//failed
else
DeleteFile (szErrPropFilePath);
endif;
endif;
endif;
endif;
0 Kudos