[REBOL] Re: How to access files ' properties under Windows
From: petr:krenzelok:trz:cz at: 19-Apr-2002 19:26
Holger Kruse wrote:
>On Fri, Apr 19, 2002 at 09:24:04AM +0200, Coussement Christophe wrote:
>
>>Hi:
>>
>>I'm looking for the library where I can find
>>the functions which access the files properties
>>(created/modified/accessed date, attributes, ...)
>>under Windows NT.
>>More specifically to make a file read only or to check
>>its read only status from a REBOL routine!
>>
>
>You don't need routines for that. REBOL can do that by itself,
>and in a platform-independent way. Check http://www.rebol.com/docs/core25.html
>and in particular the section on get/set-modes.
>
I thought so :-) Well, I just looked into docs and it works a little bit
strange way - I mean - syntax ...
----------
->> get-modes somefileordir 'file-modes
== [file-note creation-date archived script (...a few more...) ]
To obtain the actual mode settings for a port the returned block has to
be used in another call to get-modes:
->> get-modes somefileordir get-modes somefileordir 'file-modes
== [file-note: "cool graphics" creation-date: 1-Jan-2000 archived: true
script: false]
-------------
why does not 'get-modes directly return an object, as for e.g. errors
do? Wouldn't it simplify the way it works? You return the block of words
anyway, as seen in the first case, so it could be:
modes: get-modes %user.r 'file-modes
modes/creation-date
; or even checking ...
if word? in modes 'creation date [modes/creation-date]
... looks better than:
modes: context get-modes %user.r get-modes %user.r 'file-modes
Well, just my opinion :-) ... but Holger, I have to ask anyway - will it
be changed for Core 2.6? :-)
-pekr-