What is the rationale behind std.file.setAttributes ?
Marco Leise
Marco.Leise at gmx.de
Fri Dec 27 22:21:28 PST 2013
Am Fri, 27 Dec 2013 22:12:37 -0800
schrieb Jonathan M Davis <jmdavisProg at gmx.com>:
> On Saturday, December 28, 2013 06:54:53 Marco Leise wrote:
> > For Phobos we need portable solutions. But it is also clear that
> > std.file.setAttributes cannot be replaced to 100% by a portable
> > solution. The question is: Does portable code _care_ about setting
> > each possible chmod flag or Windows file attribute? Or are the use
> > cases much more limited there, like making a file read-only or
> > querying if it is a directory?
>
> We need to try hard to make Phobos cross-platform and portable, but some stuff
> just can't be, and std.file already has some functions which fall in that
> category (e.g. anything symlink related or dealing with file times). And having
> a D wrapper around that functionality can make code much cleaner, so I'm all
> for having a limited number of system-specific functions in std.file if that's
> what it takes to get the job done (and file permissions tend to fall in that
> category).
>
> - Jonathan M Davis
But SetFileAttributes doesn't set file permissions (except for
"read-only")! Chmod does. If you want a D wrapper for
POSIX chmod in std.file, it should be exactly that. For
Windows you need to work with ACLs to change permissions.
--
Marco
More information about the Digitalmars-d
mailing list