[Issue 9455] File.isBinaryMode and more

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 9 11:38:25 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9455


Kevin L <kevin.lamonte at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kevin.lamonte at gmail.com


--- Comment #1 from Kevin L <kevin.lamonte at gmail.com> 2013-07-09 11:38:23 PDT ---
(In reply to comment #0)
> - Add isBinaryMode/isWriteable/isReadable properties to File, and implement
> them as light wrappers around platform-specific functions that get that
> information.

I vote that there be five new functions:

* isReadable(inout(C)[] path) (or perhaps canRead()): for files, a
std.stdio.open(..., "r") will succeed; for directories, std.file.dirEntries()
will succeed.

* isWriteable(inout(C)[] path) (or perhaps canWrite()):  for files, a
std.stdio.open(..., "w") will succeed; for directories, creating a new file in
the directory will succeed (excluding things like no space on device).  Open
question if this function should detect write-only media and return false if
so.

* isExecutable(inout(C)[] path) (or perhaps canExecute()): for files,
exec()/fork()/popen()/etc. (and wrappers) will succeed; always false for
directories.

* isTraversable(inout(C)[] path): always false for files; for directories, a
chdir() will succeed OR a file in the directory can be stat()d.  (This is the
traditional POSIX view of execute bit on a directory.)

* std.stdio.File.isBinary(): returns true if the file was opened with "rb" or
"wb".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list