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

path.isAbsolute return false for ~ on Ubuntu #29164

Closed
arxeiss opened this issue Aug 16, 2019 · 3 comments
Closed

path.isAbsolute return false for ~ on Ubuntu #29164

arxeiss opened this issue Aug 16, 2019 · 3 comments
Labels
invalid Issues and PRs that are invalid. path Issues and PRs related to the path subsystem.

Comments

@arxeiss
Copy link

arxeiss commented Aug 16, 2019

  • Version: v12.8.0
  • Platform: Ubuntu 19.04 (Linux 5.0.0-23-generic Simple project messaging. #24-Ubuntu SMP Mon Jul 29 15:36:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux)

I'm checking if given path in config file is absolute or relative. It works great however not when ~ is used. Then it returns false.

Here is my code

import path from 'path';

path.isAbsolute('/var/www/index.html'); // true
path.isAbsolute('./index.html'); // false
path.isAbsolute('~/Documents/test.json'); // false - THIS IS BAD
@cjihrig
Copy link
Contributor

cjihrig commented Aug 16, 2019

The problem is that the path module doesn't know anything about expanding the ~ (that's a shell thing).

@bnoordhuis bnoordhuis added invalid Issues and PRs that are invalid. path Issues and PRs related to the path subsystem. labels Aug 16, 2019
@bnoordhuis
Copy link
Member

As Colin mentions, the path module doesn't do shell expansion. Closing, not a bug.

@arxeiss
Copy link
Author

arxeiss commented Aug 19, 2019

Sorry guys, my fault. I always thought that ~ is regular path descriptor for Linux, not a shell thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Issues and PRs that are invalid. path Issues and PRs related to the path subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants