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

Linux/Unix: Resolve ~ #22470

Closed
HappyStriker opened this issue Aug 23, 2018 · 4 comments
Closed

Linux/Unix: Resolve ~ #22470

HappyStriker opened this issue Aug 23, 2018 · 4 comments
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system.

Comments

@HappyStriker
Copy link

Is your feature request related to a problem? Please describe.

nodejs does not resolve the ~ to the users home directory in linux/unix environments.
so the following code fails:

const fs = require(`fs`);
console.log(fs.readdirSync(`~`));

with:

Error: ENOENT: no such file or directory, scandir '~'
    at Object.fs.readdirSync (fs.js:895:3)

Describe the solution you'd like

Resolve ~ to the path of the users home directory.

@addaleax addaleax added fs Issues and PRs related to the fs subsystem / file system. feature request Issues that request new features to be added to Node.js. labels Aug 23, 2018
@ghost
Copy link

ghost commented Aug 23, 2018

Maybe you can use something like this:

const os = require('os');
const fs = require('fs');
console.log(fs.readdirSync(os.homedir()));

And maybe you'll have to wait the publishment of this, if possible. So for a quick fixture for you @HappyStriker

@silverwind
Copy link
Contributor

This has been brought up a few times in the past, the last time at #684.

@mscdex
Copy link
Contributor

mscdex commented Aug 23, 2018

I'm still -1 for the reasons given in the referenced issue.

@addaleax
Copy link
Member

I am fairly confident that we won’t get consensus on this feature, given the above comments and the previous issues on this topic, so I think it’s best to close this rather than have it linger around forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

4 participants