Singe Toolbar for ZB is working!

This commit is contained in:
Scott Duensing 2023-11-24 22:13:53 -06:00
parent 48564570b3
commit b9b6236981
4 changed files with 32 additions and 11 deletions

View file

@ -891,6 +891,7 @@ void unpackGames(void) {
packageType = x;
break;
}
x++;
}
if (packageType >= 0) {
showHeader();

View file

@ -4621,7 +4621,8 @@ void startControllers(void) {
void startLuaContext(lua_State *L) {
size_t length;
size_t length;
int i;
// What to do when bad things happen
lua_atpanic(L, luaError);
@ -4639,9 +4640,15 @@ void startLuaContext(lua_State *L) {
lua_getfield(L, -1, "searchers");
// Get the number of existing searchers in the table
length = lua_rawlen(L, -1);
// Add our own searcher to the list
// Shift existing elements to make room for ours
for (i=length+1; i>1; i--) {
lua_rawgeti(L, -2, i - 1);
lua_rawseti(L, -2, i);
}
// Add our own searcher to the front of the list
lua_pushcfunction(L, luaSearcher);
lua_rawseti(L, -2, length + 1);
//lua_rawseti(L, -2, length + 1);
lua_rawseti(L, -2, 1);
// Remove the seachers and the package tables from the stack
lua_pop(L, 2);
}

View file

@ -166,10 +166,16 @@ static int os_rename (lua_State *L) {
}
#include <unistd.h>
static int os_tmpname (lua_State *L) {
char buff[LUA_TMPNAMBUFSIZE];
int err;
lua_tmpnam(buff, err);
//lua_tmpnam(buff, err);
int fd = mkstemp(buff); // With this…
if (fd >= 0)
close(fd);
if (l_unlikely(err))
return luaL_error(L, "unable to generate a unique filename");
lua_pushstring(L, buff);

View file

@ -25,6 +25,7 @@ local configId = ID("singemenu.singemenu")
local id = ID("singetoolbar.singemenu")
local tool
local settings
local line = "-------------------------------------------------------------------------------"
local function utilDump(o)
@ -142,9 +143,13 @@ local function configureSinge(self)
end
local function singeEnd()
ide:Print("\n"..line)
end
local function singeOutput(s)
--ide:GetOutput():Write(s)
ide:Print("[] " .. s)
ide:GetOutput():Write(s)
end
@ -153,6 +158,8 @@ local function startSinge(self)
local cdir = wx.wxFileName.GetCwd()
local wdir
local launch
local env
local ok
if settings then
if not settings.singe then message = "You must specify the Singe executable in the Singe configuration." end
@ -171,13 +178,13 @@ local function startSinge(self)
launch = settings.singe .. ' ' .. settings.options .. ' -v ' .. settings.video .. ' ' .. settings.script
launch = launch:gsub(wdir, "./", 1):gsub(wdir, "")
wdir = wx.wxFileName.DirName(wdir):GetFullPath()
ide:Print(line)
ide:Print(launch)
ide:ExecuteCommand(launch, wdir, singeOutput)
--wx.wxFileName.SetCwd(wdir)
--wx.wxExecute(launch)
--wx.wxFileName.SetCwd(cdir)
ok, env = wx.wxGetEnv('LUA_CPATH')
wx.wxUnsetEnv('LUA_CPATH')
ide:ExecuteCommand(launch, wdir, singeOutput, singeEnd)
wx.wxSetEnv('LUA_CPATH', env)
end