diff options
Diffstat (limited to 'src/bindings.c')
-rw-r--r-- | src/bindings.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bindings.c b/src/bindings.c index 7a94020..45abf6a 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -86,6 +86,17 @@ int markdown(lua_State *L) /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +int current_working_directory(lua_State *L) +{ + char *cwd = getcwd(NULL, 0); + lua_pushstring(L, cwd); + free(cwd); + return 1; +} + + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + static void throw_directory_error(lua_State *L, char *dir_name); static struct dirent *read_dir(lua_State *L, DIR *directory); |