Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ospaths] BUG: splitFile("/a.txt").dir = "" ; + other bugs with splitFile #8255

Closed
3 tasks
timotheecour opened this issue Jul 10, 2018 · 4 comments · Fixed by #10047
Closed
3 tasks

[ospaths] BUG: splitFile("/a.txt").dir = "" ; + other bugs with splitFile #8255

timotheecour opened this issue Jul 10, 2018 · 4 comments · Fixed by #10047
Labels
OS (stdlib) Related to OS modules in standard library Standard Library

Comments

@timotheecour
Copy link
Member

timotheecour commented Jul 10, 2018

  • bug 1:
    nim:
    echo splitFile("/a.txt")
    (dir: "", name: "a", ext: ".txt") #definitely wrong

python:
os.path.split("/a.txt")
('/', 'a.txt')

  • bug 2:
    nim:
    echo splitFile("a/")
    (dir: "a/", name: "", ext: "") # violates good sense, and also documention: "dir does not end in DirSep. extension includes the leading dot."

python:
os.path.split("a/")
('a', '')

  • bug 6
    echo splitFile("a/..")
    (dir: "a", name: ".", ext: ".")
    should be:
    (dir: "a", name: "..")
@timotheecour timotheecour changed the title [ospaths] BUG: splitFile("/a.txt") returns (dir: "", name: "a", ext: ".txt") [ospaths] BUG: splitFile("/a.txt").dir = "" ; + other bugs with splitFile Jul 10, 2018
@timotheecour timotheecour changed the title [ospaths] BUG: splitFile("/a.txt").dir = "" ; + other bugs with splitFile [ospaths] BUG: splitFile("/a.txt").dir = "" ; + other bugs with splitFile, parentDir Jul 10, 2018
@Araq
Copy link
Member

Araq commented Jul 10, 2018

Bug 1 is documented behaviour and encoded in the return type!

@andreaferretti
Copy link
Collaborator

I think bug 1 is about dir, which should be /

@timotheecour
Copy link
Member Author

I think bug 1 is about dir, which should be /

yes, that is the bug I'm referring to

@timotheecour timotheecour added the OS (stdlib) Related to OS modules in standard library label Oct 25, 2018
timotheecour added a commit to timotheecour/Nim that referenced this issue Dec 19, 2018
@timotheecour timotheecour changed the title [ospaths] BUG: splitFile("/a.txt").dir = "" ; + other bugs with splitFile, parentDir [ospaths] BUG: splitFile("/a.txt").dir = "" ; + other bugs with splitFile Dec 19, 2018
@timotheecour
Copy link
Member Author

=> PR to fix it: #10047

timotheecour added a commit to timotheecour/Nim that referenced this issue Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS (stdlib) Related to OS modules in standard library Standard Library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants