Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

path.parse : basename + path.sep issue #9298

Closed
@AaronNGray

Description

@AaronNGray

Hi,

Don't know whether this is really an issue or not but paths with no file specified and a trailing directory path separator make the 'base' value the last directory, rather than it being blank. This seems a might inconsistent ?

I am getting the same results on Windows and Linux.

var path = require("path");

function path_test() {
    var p = path.parse(path.sep + "test" + path.sep + "test2" + path.sep);

    console.log("root: ", p.root);
    console.log("dir: ", p.dir);
    console.log("base: ", p.base);
    console.log("name: ", p.name);
    console.log("ext: ", p.ext);
}

path_test();

gives

root:  \
dir:  \test
base:  test2
name:  test2
ext:

as base and name are the same its a bit hard to differentiate all cases IMHO

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions