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

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

Closed
AaronNGray opened this issue Feb 27, 2015 · 7 comments
Closed

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

AaronNGray opened this issue Feb 27, 2015 · 7 comments
Labels

Comments

@AaronNGray
Copy link

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

@jameshartig
Copy link

I think someone misconfigured the issue mover

@jasnell
Copy link
Member

jasnell commented Mar 3, 2015

Likely not ideal but the documentation here seems to be lacking so it's not clear. / cc @tjfontaine thoughts?

@AaronNGray
Copy link
Author

There don't seem to be any test cases for trailing slash, and the test
cases that are there are pretty minimal.

On 3 March 2015 at 23:46, James M Snell [email protected] wrote:

Likely not ideal but the documentation here seems to be lacking so it's
not clear. / cc @tjfontaine https://github.com/tjfontaine thoughts?


Reply to this email directly or view it on GitHub
#9298 (comment).

@jasnell jasnell added the path label Jun 25, 2015
gibfahn pushed a commit to ibmruntimes/node that referenced this issue Feb 22, 2017
The cherry-pick of nodejs#7612 to v4.x (4369055) added in nodejs#9298 wasn't quite
correct as it depends on a runtime function %SymbolDescriptiveString
that doesn't exist on v4.x. We can use %SymbolDescription instead.

Ref: nodejs/node#7612
Ref: nodejs/node#9298

PR-URL: nodejs/node#10732
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
gibfahn pushed a commit to ibmruntimes/node that referenced this issue Feb 22, 2017
The cherry-pick of nodejs#7612 to v4.x (4369055) added in nodejs#9298 wasn't quite
correct as it depends on a runtime function %SymbolDescriptiveString
that doesn't exist on v4.x. We can use %SymbolDescription instead.

Ref: nodejs/node#7612
Ref: nodejs/node#9298

PR-URL: nodejs/node#10732
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@Trott Trott closed this as completed Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
@AaronNGray @jameshartig @jasnell @Trott and others