summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-24 22:04:27 +0100
committerwm4 <wm4@nowhere>2015-03-24 22:04:27 +0100
commit08df18aea35d5e6215f9307f0a9c187464442020 (patch)
treecfbcef4244864feedb09789e434d3cf63cf66b18
parent36c4ac8464fc19bd8820ee02e2c0f228071764af (diff)
downloadmpv-08df18aea35d5e6215f9307f0a9c187464442020.tar.bz2
mpv-08df18aea35d5e6215f9307f0a9c187464442020.tar.xz
lua: replace getcwd() implementation
-rw-r--r--player/lua.c14
-rw-r--r--player/lua/defaults.lua4
2 files changed, 4 insertions, 14 deletions
diff --git a/player/lua.c b/player/lua.c
index f329c47d11..651162342f 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -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),
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index 3a55e3a206..265463a8f3 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -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 {}