Bug 2552 – std.path.isabs broken for Windows

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2009-01-02T17:34:00Z
Last change time
2014-02-24T15:57:30Z
Assigned to
andrei
Creator
darkuranium

Comments

Comment #0 by darkuranium — 2009-01-02T17:34:30Z
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 by andrei — 2009-01-02T19:21:20Z
(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 by jarrett.billingsley — 2009-01-02T19:48:27Z
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 by andrei — 2010-09-26T14:22:27Z
I'll close this considering that isabs is correct as is.