Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 10, 2006 isabs not working | ||||
---|---|---|---|---|
| ||||
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 |
February 10, 2006 Re: isabs not working | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kramer | "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? |
February 10, 2006 Re: isabs not working | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | 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? > > |
February 10, 2006 Re: isabs not working | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | 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).
|
Copyright © 1999-2021 by the D Language Foundation