www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - isabs not working

reply Kramer <Kramer_member pathlink.com> writes:
The following assert (which is in the unittests) fails for std.path.isabs().

assert(isabs(r"\relative\path") == 0);

According to the docs (unless I've been starring at the screen for too long),
this assert should pass?

IMHO though, even for Windows, I think if a path starts with a separator, it
should be considered absolute.

-Kramer
Feb 10 2006
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Kramer" <Kramer_member pathlink.com> wrote in message 
news:dsj2nu$29hl$1 digitaldaemon.com...
 The following assert (which is in the unittests) fails for 
 std.path.isabs().

 assert(isabs(r"\relative\path") == 0);

 According to the docs (unless I've been starring at the screen for too 
 long),
 this assert should pass?

 IMHO though, even for Windows, I think if a path starts with a separator, 
 it
 should be considered absolute.
Well, I'm not so sure. In Windows, at least, the path "\relative\path" is actually relative to the current drive - thus, it doesn't provide enough information to uniquely identify a file on the system. It could mean c:\relative\path, or d:\relative\path, etc. I don't know that much about *nix, but is it true that there's no real concept of drives? Or at least, not in the same way as in DOS/Windows?
Feb 10 2006
next sibling parent Kramer <Kramer_member pathlink.com> writes:
In article <dsj328$2ae9$1 digitaldaemon.com>, Jarrett Billingsley says...
"Kramer" <Kramer_member pathlink.com> wrote in message 
news:dsj2nu$29hl$1 digitaldaemon.com...
 The following assert (which is in the unittests) fails for 
 std.path.isabs().

 assert(isabs(r"\relative\path") == 0);

 According to the docs (unless I've been starring at the screen for too 
 long),
 this assert should pass?

 IMHO though, even for Windows, I think if a path starts with a separator, 
 it
 should be considered absolute.
Well, I'm not so sure. In Windows, at least, the path "\relative\path" is actually relative to the current drive - thus, it doesn't provide enough information to uniquely identify a file on the system. It could mean c:\relative\path, or d:\relative\path, etc.
Yes, this is true. And I had to think about it for a bit before deciding I thought it was abs. The reason is, in the shell, if you're several directories deep and you do "cd \" it takes you back to the root of that drive. But again, as you say, it's "...relative to the current drive". Ok, so I'll buy that. Then at the very least, isabs should work as stated in the docs.
I don't know that much about *nix, but is it true that there's no real 
concept of drives?  Or at least, not in the same way as in DOS/Windows? 
Feb 10 2006
prev sibling parent nascent <jesse.phillips eagles.ewu.edu> writes:
Jarrett Billingsley wrote:
 "Kramer" <Kramer_member pathlink.com> wrote in message 
 news:dsj2nu$29hl$1 digitaldaemon.com...
 
The following assert (which is in the unittests) fails for 
std.path.isabs().

assert(isabs(r"\relative\path") == 0);

According to the docs (unless I've been starring at the screen for too 
long),
this assert should pass?

IMHO though, even for Windows, I think if a path starts with a separator, 
it
should be considered absolute.
Well, I'm not so sure. In Windows, at least, the path "\relative\path" is actually relative to the current drive - thus, it doesn't provide enough information to uniquely identify a file on the system. It could mean c:\relative\path, or d:\relative\path, etc. I don't know that much about *nix, but is it true that there's no real concept of drives? Or at least, not in the same way as in DOS/Windows?
Yeah, *nix uses "folders" which point to the device (drive).
Feb 10 2006