Skip to content

[TODO] bugs with parentDir #8734

@timotheecour

Description

@timotheecour
  • bug 2:
  • parentDir("a/b//")==a/b is a bug
    (but parentDir("a/b/") == a is OK)

EDIT: fixed

  • bug 3:
    echo parentDir("/")
    empty, which is a bug
    rdmd --eval 'std.path.dirName("/").writeln'
    /
    os.path.split("/")
    ('/', '')
    Curiously, echo splitFile("/") is correct:
    (dir: "/", name: "", ext: "")
    shouldn't parentDir be implemented in terms of splitFile? or is that for efficiency optimization ? (if so, see [WIP] nim needs a slice type analag to D's T[] dynamic array #8256)

EDIT: still not fixed; whichever convention is used, splitFile vs parentDir still disagree

  • bug 4:
    echo parentDir("/a.txt")
    empty, which is a bug (and inconsistent with splitFile)

EDIT: still not fixed

  • bug 5
    splitFile documentation says: "dir does not end in DirSep" but should say "dir does not end in DirSep" unless it's "/"
    EDIT: still not fixed

  • bug 6 [NEW]
    parentDir("foo") returns "" instead of "."

NOTE: D and python differ for the following case:

D: rdmd --eval 'std.path.dirName("/a/a/").writeln' /a python: os.path.split("/a/a/") ('/a/a', '') nim: echo parentDir("/a/a/") /a 

that one should be documented

  • bug 7:
    parentDir(".") is empty instead of ".."
    parentDir("..") is empty instead of "../.."

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions