Skip to content

Commit

Permalink
Update to libuv 1.6.0 and add uv.os_homedir
Browse files Browse the repository at this point in the history
  • Loading branch information
creationix committed Jun 3, 2015
1 parent 0488c31 commit ff802e8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/duv.c
Expand Up @@ -114,6 +114,7 @@ static const duk_function_list_entry duv_funcs[] = {
{"loadavg", duv_loadavg, 0},
{"exepath", duv_exepath, 0},
{"cwd", duv_cwd, 0},
{"os_homedir", duv_os_homedir, 0},
{"chdir", duv_chdir, 1},
{"get_total_memory", duv_get_total_memory, 0},
{"hrtime", duv_hrtime, 0},
Expand Down
8 changes: 8 additions & 0 deletions src/misc.c
Expand Up @@ -231,6 +231,14 @@ duk_ret_t duv_cwd(duk_context *ctx) {
return 1;
}

duk_ret_t duv_os_homedir(duk_context *ctx) {
size_t size = 2*PATH_MAX;
char path[2*PATH_MAX];
duv_check(ctx, uv_os_homedir(path, &size));
duk_push_lstring(ctx, path, size);
return 1;
}

duk_ret_t duv_chdir(duk_context *ctx) {
const char* path;

Expand Down
1 change: 1 addition & 0 deletions src/misc.h
Expand Up @@ -15,6 +15,7 @@ duk_ret_t duv_interface_addresses(duk_context *ctx);
duk_ret_t duv_loadavg(duk_context *ctx);
duk_ret_t duv_exepath(duk_context *ctx);
duk_ret_t duv_cwd(duk_context *ctx);
duk_ret_t duv_os_homedir(duk_context *ctx);
duk_ret_t duv_chdir(duk_context *ctx);
duk_ret_t duv_get_total_memory(duk_context *ctx);
duk_ret_t duv_hrtime(duk_context *ctx);
Expand Down

0 comments on commit ff802e8

Please sign in to comment.