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

don't rely on HOME environment variable for homedir? #11331

Closed
stevengj opened this issue May 18, 2015 · 1 comment
Closed

don't rely on HOME environment variable for homedir? #11331

stevengj opened this issue May 18, 2015 · 1 comment
Labels
io Involving the I/O subsystem: libuv, read, write, etc.
Milestone

Comments

@stevengj
Copy link
Member

In JuliaLang/IJulia.jl#309, there was a failure that seems to have been caused by the HOME environment variable not being defined (when Julia is launched by IPython in a virtualenv), although we are still trying to pin down the problem.

It occurred to me that relying on this environment variable for the homedir() function might not be completely robust.

  • On Unix, we could instead call getpwuid(getuid())->pw_dir
  • On Windows, there is SHGetKnownFolderPath with the FOLDERID_Profile option.

We would probably have to write a helper routine in C to access these reliably (e.g. to get struct passwd from pwd.h).

@stevengj
Copy link
Member Author

The next release of libuv will have uv_os_homedir, which we can use for this purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
io Involving the I/O subsystem: libuv, read, write, etc.
Projects
None yet
Development

No branches or pull requests

2 participants