summaryrefslogtreecommitdiff
path: root/lib/luacd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/luacd.cpp')
-rw-r--r--lib/luacd.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/lib/luacd.cpp b/lib/luacd.cpp
index 7a44286..b619905 100644
--- a/lib/luacd.cpp
+++ b/lib/luacd.cpp
@@ -51,6 +51,9 @@ enum cdutils_methods_t {
CDUTILS_UPDATESIZE,
CDUTILS_UPDATESECTOR,
CDUTILS_CREATESECTOR,
+ CDUTILS_INFOS,
+ CDUTILS_PATH,
+ CDUTILS_PRINTDIR,
};
enum cdutils_functions_t {
@@ -83,6 +86,9 @@ struct lua_functypes_t cdutils_methods[] = {
{ CDUTILS_UPDATESIZE, "updatesize", 2, 2, { BLUA_STRING, BLUA_NUMBER } },
{ CDUTILS_UPDATESECTOR, "updatesector", 2, 2, { BLUA_STRING, BLUA_NUMBER } },
{ CDUTILS_CREATESECTOR, "createsector", 2, 3, { BLUA_NUMBER, BLUA_NUMBER, BLUA_BOOLEAN } },
+ { CDUTILS_INFOS, "infos", 0, 0, { } },
+ { CDUTILS_PATH, "path", 0, 0, { } },
+ { CDUTILS_PRINTDIR, "printdir", 1, 1, { BLUA_STRING } },
{ -1, 0, 0, 0, 0 }
};
@@ -118,6 +124,9 @@ class sLua_cdutils : public Base {
DECLARE_METHOD(cdutils, CDUTILS_UPDATESIZE);
DECLARE_METHOD(cdutils, CDUTILS_UPDATESECTOR);
DECLARE_METHOD(cdutils, CDUTILS_CREATESECTOR);
+ DECLARE_METHOD(cdutils, CDUTILS_INFOS);
+ DECLARE_METHOD(cdutils, CDUTILS_PATH);
+ DECLARE_METHOD(cdutils, CDUTILS_PRINTDIR);
DECLARE_FUNCTION(cdutils, CDUTILS_NEWCDUTILS);
DECLARE_FUNCTION(cdutils, CDUTILS_SWAPWORD);
@@ -154,6 +163,9 @@ void Luacdutils::pushmembers(Lua * L) {
PUSH_METHOD(cdutils, CDUTILS_UPDATESIZE);
PUSH_METHOD(cdutils, CDUTILS_UPDATESECTOR);
PUSH_METHOD(cdutils, CDUTILS_CREATESECTOR);
+ PUSH_METHOD(cdutils, CDUTILS_INFOS);
+ PUSH_METHOD(cdutils, CDUTILS_PATH);
+ PUSH_METHOD(cdutils, CDUTILS_PRINTDIR);
}
void Luacdutils::pushstatics(Lua * L) throw (GeneralException) {
@@ -453,9 +465,35 @@ int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) {
eof = L->toboolean(4);
cd->create_sector(mode, sect, eof);
break;
+ case CDUTILS_INFOS:
+ if (cd)
+ cd->show_iso_infos();
+ else
+ L->error("Cdutils object void");
+ break;
+ case CDUTILS_PATH:
+ if (cd)
+ cd->show_pt_infos();
+ else
+ L->error("Cdutils object void");
+ break;
+ case CDUTILS_PRINTDIR:
+ path = L->tostring(1);
+ if (cd) {
+ char * f;
+ cdutils::DirEntry dir = cd->find_path(f = path.strdup());
+ free(f);
+ if (!dir.R)
+ L->error("Path `" + path + "' not found");
+ if (!(dir.Flags & 2))
+ L->error("Path `" + path + "' points to a file");
+ cd->show_head_entry();
+ cd->show_dir(&dir);
+ } else
+ L->error("Cdutils object void");
+ break;
}
-
return r;
}