www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.file.exists is wrong for linux

reply James Dunne <james.jdunne gmail.com> writes:
int exists(char[] name)
{
*  return access(toStringz(name),0) != 0;

should be

*  return access(toStringz(name), 0) == 0;

0 is used as the success value for access, according to the man pages.  It
should also return a bit/bool, not int.

Regards,
James Dunne
Aug 27 2005
parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"James Dunne" <james.jdunne gmail.com> wrote in message 
news:der1dj$2cs4$1 digitaldaemon.com...
 int exists(char[] name)
 {
 *  return access(toStringz(name),0) != 0;

 should be

 *  return access(toStringz(name), 0) == 0;

 0 is used as the success value for access, according to the man pages.  It
 should also return a bit/bool, not int.

 Regards,
 James Dunne
fwiw, the unittests on Linux fail in std.math (line 247), std.file (on the issue you mention) and std.boxer (I can't remember which line).
Aug 27 2005