diff options
author | cjihrig <cjihrig@gmail.com> | 2015-05-12 09:17:19 -0400 |
---|---|---|
committer | Saúl Ibarra Corretgé <saghul@gmail.com> | 2015-05-21 17:31:35 +0200 |
commit | a62c2d592888f4a5d8996e4cb901aab426edf8d2 (patch) | |
tree | 5abe22d7f1c934cd15ccf1f376ac16bdc4ae874e /docs/src | |
parent | d1b5008e7637bee5bd05c4663361ceca590f04ef (diff) | |
download | libuv-a62c2d592888f4a5d8996e4cb901aab426edf8d2.tar.gz libuv-a62c2d592888f4a5d8996e4cb901aab426edf8d2.zip |
unix,win: add uv_os_homedir()
PR-URL: https://github.com/libuv/libuv/pull/350
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/misc.rst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/src/misc.rst b/docs/src/misc.rst index bb97a260..54681f70 100644 --- a/docs/src/misc.rst +++ b/docs/src/misc.rst @@ -227,6 +227,23 @@ API Changes the current working directory. +.. c:function:: int uv_os_homedir(char* buffer, size_t* size) + + Gets the current user's home directory. On Windows, `uv_os_homedir()` first + checks the `USERPROFILE` environment variable using + `GetEnvironmentVariableW()`. If `USERPROFILE` is not set, + `SHGetKnownFolderPath()` is called. On all other operating systems, + `uv_os_homedir()` first checks the `HOME` environment variable using + :man:`getenv(3)`. If `HOME` is not set, :man:`getpwuid_r(3)` is called. The + user's home directory is stored in `buffer`. When `uv_os_homedir()` is + called, `size` indicates the maximum size of `buffer`. On success or + `UV_ENOBUFS` failure, `size` is set to the string length of `buffer`. + + .. warning:: + `uv_os_homedir()` is not thread safe. + + .. versionadded:: 1.6.0 + .. uint64_t uv_get_free_memory(void) .. c:function:: uint64_t uv_get_total_memory(void) |