What is the rationale behind std.file.setAttributes ?

Jacob Carlborg doob at me.com
Sat Dec 28 06:23:55 PST 2013


On 2013-12-28 03:46, Marco Leise wrote:

> Wait a second, what about *setting* attributes? Some difficult
> ones are:
>
> o toggling read-only (for whom? user, group, others?)
> o executable flag
> o hidden flag
>
> On Windows 'executable' is implicit and based on the extension.
> On Posix 'hidden' is implicit for a file name beginning with a
> dot. We can read the hidden bit on POSIX, but we cannot toggle
> it for example. So we can either not expose these attributes
> at all, ignore them where not applicable when setting
> attributes or add a third state "ignore".

In addition to that Mac OS X has an additional way of indicating if a 
file is is hidden or not. More similar to how it works on Windows then 
the naming scheme from Posix.

> Or looking at it another way:
> DOS attr < POSIX chmod < ACLs
>
> How do other programming languages find a common ground?

On the top of the documentation of the File class in Ruby, it says the 
following:

"In the description of File methods, permission bits are a 
platform-specific set of bits that indicate permissions of a file."

And

"On non-Posix operating systems, there may be only the ability to make a 
file read-only or read-write. In this case, the remaining permission 
bits will be synthesized to resemble typical values."

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list