FishSpeaker
16th November 2002 22:06 UTC
SetFileAttributes problem
I'm using NSIS 1.98.
The documentation says that SetFileAttributes accepts wildcards. When I try to use them, however, the command doesn't work, and the errors flag is set. Using the command without wildcards works.
For example:
; this doesn't work
SetFileAttributes "$INSTDIR\subDir\*.*" READONLY
; this works
SetFileAttributes "$INSTDIR\subDir\somefile.txt" READONLY
Is this a bug, or am I doing something wrong?
Yathosho
17th November 2002 00:55 UTC
you could do a loop detecting every single file in the dir and change the attributes of each.
kichik
17th November 2002 16:45 UTC
It's not a bug. The documentation is just wrong.
Like killahbite said, you can make a loop using FindFirst, FindNext and FindNext and change them one by one.
FishSpeaker
17th November 2002 21:39 UTC
thanks guys
virtlink
18th November 2002 11:18 UTC
Originally posted by kichik
It's not a bug. The documentation is just wrong.
Like killahbite said, you can make a loop using FindFirst, FindNext and FindNext and change them one by one.
Wouldn't it be an idea if wildcards are supported? It would make looping unnescessary, and the script will be better readable.
kichik
18th November 2002 14:22 UTC
Microsoft doesn't support this and I won't include wildcards support inside NSIS, that's not necessary.
Mottel
19th November 2002 06:31 UTC
Exec Attrib ...
Couldn't you Exec the Attrib command to do it?
Smile2Me
19th November 2002 09:08 UTC
Then you should also log output to some temp file (and delete it) otherwise a dos box will pop up.
But I can remember I wrote some function for these things (changing all attributes in a specific dir), but I do not have the source with me now. Maybe it is on Sunjammers site. I would propose you have a look there.
:-H
[edit]
OK, here's the link: http://www.clantpa.co.uk/nsis/wiki/index.php/Attrib
[/edit]
bugfix
24th November 2002 10:14 UTC
My solution to the the same problem is to use the
execshell attrib
:)