lua: replace getcwd() implementation

This commit is contained in:
wm4
2015-03-24 22:04:27 +01:00
parent 36c4ac8464
commit 08df18aea3
2 changed files with 4 additions and 14 deletions

View File

@@ -1088,19 +1088,6 @@ static int script_get_wakeup_pipe(lua_State *L)
return 1;
}
static int script_getcwd(lua_State *L)
{
char *cwd = mp_getcwd(NULL);
if (!cwd) {
lua_pushnil(L);
lua_pushstring(L, "error");
return 2;
}
lua_pushstring(L, cwd);
talloc_free(cwd);
return 1;
}
static int script_readdir(lua_State *L)
{
// 0 1 2 3
@@ -1305,7 +1292,6 @@ static const struct fn_entry main_fns[] = {
};
static const struct fn_entry utils_fns[] = {
FN_ENTRY(getcwd),
FN_ENTRY(readdir),
FN_ENTRY(split_path),
FN_ENTRY(join_path),

View File

@@ -542,4 +542,8 @@ function mp_utils.to_string(v, set)
end
end
function mp_utils.getcwd()
return mp.get_property("working-directory")
end
return {}