D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2552 - std.path.isabs broken for Windows
Summary: std.path.isabs broken for Windows
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P3 normal
Assignee: Andrei Alexandrescu
URL: http://www.digitalmars.com/d/1.0/phob...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-02 17:34 UTC by Tim Čas
Modified: 2014-02-24 15:57 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Tim Čas 2009-01-02 17:34:30 UTC
std.path.isabs(char[]) falsely reports paths as relative when they are, indeed, absolute. For example:

isabs("/test") => 0 (should be 1)
isabs("\test") => 0 (should be 1)

Here is the program I used to test this -- see the comments in the source for instructions (they are importaint):
http://paste.dprogramming.com/dpavbrtf

As you can see, although all paths are reported as relative, they are indeed absolute.
This is visible by the fact that main.d cannot find test-rel which lies in the same dir as the program itself.
It can, however find test-abs, which lies the root of the drive.
Comment 1 Andrei Alexandrescu 2009-01-02 19:21:20 UTC
(In reply to comment #0)
> std.path.isabs(char[]) falsely reports paths as relative when they are, indeed,
> absolute. For example:
> 
> isabs("/test") => 0 (should be 1)
> isabs("\test") => 0 (should be 1)

The drives are lacking. In Windows terminology, does a drive-less path still qualify as absolute? (I looked around MSDN, couldn't find a good definition.)
Comment 2 Jarrett Billingsley 2009-01-02 19:48:27 UTC
It's tricky.  Windows accepts such paths, and they are absolute to the current drive, but relative to the entire filesystem.  Since the same path (like "\foo\bar\baz.txt") can refer to different files based on what the current drive is set to, I guess it's still relative, in which case Phobos is right.
Comment 3 Andrei Alexandrescu 2010-09-26 14:22:27 UTC
I'll close this considering that isabs is correct as is.