diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-05-15 22:22:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-16 10:52:40 +0530 |
commit | bba553bea5938932518dc6382e464968ce8374b4 (patch) | |
tree | efd68b86734bf8703608f0165a473ac04c300272 /ext/node/lib.rs | |
parent | a31b81394b7d78e6a0e678ba4d18dda62a3b2bc5 (diff) |
fix(ext/node): homedir() `getpwuid`/`SHGetKnownFolderPath` fallback (#23841)
**Unix**: Returns the value of the HOME environment variable if it is
set even if it is an empty string. Otherwise, it tries to determine the
home directory by invoking the
[getpwuid_r](https://linux.die.net/man/3/getpwuid_r) function with the
UID of the current user.
**Windows**: Returns the value of the USERPROFILE environment variable
if it is set and it is not an empty string. Otherwise, it tries to
determine the home directory by invoking the
[SHGetKnownFolderPath](https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath)
function with
[FOLDERID_Profile](https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid).
Fixes https://github.com/denoland/deno/issues/23824
Diffstat (limited to 'ext/node/lib.rs')
-rw-r--r-- | ext/node/lib.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/node/lib.rs b/ext/node/lib.rs index 43a5b158e..b4eeb71c2 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -309,6 +309,7 @@ deno_core::extension!(deno_node, ops::os::op_node_os_username<P>, ops::os::op_geteuid<P>, ops::os::op_cpus<P>, + ops::os::op_homedir<P>, op_node_build_os, op_node_is_promise_rejected, op_npm_process_state, |