Add aegisub.decode_path, which simply wraps StandardPaths::DecodePath

Originally committed to SVN as r6130.
This commit is contained in:
Thomas Goyne 2011-12-22 21:30:05 +00:00
parent 4a3f2b8412
commit 2fdbd86a7f
2 changed files with 12 additions and 0 deletions

View File

@ -65,6 +65,7 @@
#include "include/aegisub/context.h"
#include "main.h"
#include "selection_controller.h"
#include "standard_paths.h"
#include "video_context.h"
#include "utils.h"
@ -262,6 +263,7 @@ namespace Automation4 {
set_field(L, "ms_from_frame", LuaMsFromFrame);
set_field(L, "video_size", LuaVideoSize);
set_field(L, "keyframes", LuaGetKeyframes);
set_field(L, "decode_path", LuaDecodePath);
set_field(L, "lua_automation_version", 4);
// store aegisub table to globals
@ -511,6 +513,15 @@ namespace Automation4 {
return 1;
}
int LuaScript::LuaDecodePath(lua_State *L)
{
const agi::Context *c = get_context(L);
wxString path = check_wxstring(L, 1);
lua_pop(L, 1);
lua_pushstring(L, StandardPaths::DecodePath(path).utf8_str());
return 1;
}
static void lua_threaded_call(ProgressSink *ps, lua_State *L, int nargs, int nresults, bool can_open_config, bool *failed)
{
LuaProgressSink lps(L, ps, can_open_config);

View File

@ -310,6 +310,7 @@ namespace Automation4 {
static int LuaMsFromFrame(lua_State *L);
static int LuaVideoSize(lua_State *L);
static int LuaGetKeyframes(lua_State *L);
static int LuaDecodePath(lua_State *L);
public:
LuaScript(const wxString &filename);