forked from pyrite-dev/pmake
subdirectory support
This commit is contained in:
parent
7ce5bd3cf3
commit
96f3fa1f70
9 changed files with 109 additions and 29 deletions
12
src/js_fs.c
12
src/js_fs.c
|
|
@ -95,6 +95,15 @@ static duk_ret_t js_fs_close(duk_context* self) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static duk_ret_t js_fs_cwd(duk_context* self) {
|
||||
char path[1024];
|
||||
|
||||
getcwd(path, 1024);
|
||||
duk_push_string(self, path);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void js_fs_init(void) {
|
||||
int obj;
|
||||
|
||||
|
|
@ -112,5 +121,8 @@ void js_fs_init(void) {
|
|||
duk_push_c_function(js_ctx, js_fs_close, 1);
|
||||
duk_put_prop_string(js_ctx, obj, "close");
|
||||
|
||||
duk_push_c_function(js_ctx, js_fs_cwd, 0);
|
||||
duk_put_prop_string(js_ctx, obj, "cwd");
|
||||
|
||||
duk_put_prop_string(js_ctx, 0, "fs");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue