← Back to index
|
Original Bugzilla link
Bug 3937 – os.path.dirname fails on absolute path
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2010-03-12T12:45:00Z
Last change time
2015-06-09T01:27:39Z
Assigned to
rsinfu
Creator
ellery-newcomer
Comments
Comment #0
by ellery-newcomer — 2010-03-12T12:45:01Z
According to DDoc, assert(dirname(dirname("/home/user")) == ""); however, that assert isn't in the unittest, and the actual result is ".". I would prefer "/" to either result. suggested fix: --- path.d (revision 1452) +++ path.d (working copy) @@ -359,7 +359,7 @@ * version(Posix) * { * assert(dirname("/home/user") == "/home"); - * assert(dirname(dirname("/home/user")) == ""); + * assert(dirname(dirname("/home/user")) == "/"); * } * ----- */ @@ -386,7 +386,7 @@ version(Posix) { if (fullname[i - 1] == sep[0]) - { i--; + { if(i > 1) i--; break; } } @@ -401,6 +401,7 @@ version (Posix) { assert(dirname("/path/to/file") == "/path/to"); + assert(dirname(dirname("/home/user")) == "/"); } else {
Comment #1
by rsinfu — 2010-06-23T21:19:32Z
Fixed in svn r1692. The fix will be included in release 2.048.