From e39bde9669146535cc4608499749d3372ca8c16a Mon Sep 17 00:00:00 2001 From: Damian Date: Mon, 30 Aug 2021 19:31:17 -0400 Subject: [PATCH 1/3] Raise event after changing tabs --- src/resources/emco.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/resources/emco.lua b/src/resources/emco.lua index 75eb91b..c67ff29 100644 --- a/src/resources/emco.lua +++ b/src/resources/emco.lua @@ -644,6 +644,7 @@ function EMCO:switchTab(tabName) end self.mc[tabName]:show() self.currentTab = tabName + raiseEvent("EMCO tab change", self.name, oldTab, tabName) end function EMCO:createComponentsForTab(tabName) From 8ec07d80ae3e3a7c878b97ef1a39237d7a1bdb4f Mon Sep 17 00:00:00 2001 From: Damian Date: Tue, 31 Aug 2021 18:15:18 -0400 Subject: [PATCH 2/3] improve exists/isDir to use lfs since we have it by default. Makes it more OSX compatibile --- src/resources/demontools.lua | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/resources/demontools.lua b/src/resources/demontools.lua index a00d6fd..6199335 100644 --- a/src/resources/demontools.lua +++ b/src/resources/demontools.lua @@ -7,11 +7,18 @@ local DemonTools = {} local cheatConsole = Geyser.MiniConsole:new({name = "DemonnicCheatConsole", width = 4000, wrapWidth = 10000, color = "black"}) cheatConsole:hide() local function exists(path) - local ok, err, code = os.rename(path, path) - if not ok and code == 13 then + path = path:gsub([[\]], "/") + if path:ends("/") then + path = path:sub(1,-2) + end + local ok, err, code = lfs.attributes(path) + if ok then return true end - return ok, err + if err:lower():find("no such file or directory") then + return false + end + return ok, err, code end local function isWindows() @@ -19,11 +26,20 @@ local function isWindows() end local function isDir(path) - path = path:gsub("\\", "/") - if not path:ends("/") then - path = path .. "/" + if not exists(path) then return false end + path = path:gsub([[\]], "/") + if path:ends("/") then + path = path:sub(1,-2) end - return exists(path) + local ok, err, code = lfs.attributes(path, "mode") + if ok then + if ok == "directory" then + return true + else + return false + end + end + return ok, err, code end local function mkdir_p(path) From ea83dd8082f7dcafbe7247de05d45c38d1c99834 Mon Sep 17 00:00:00 2001 From: Damian Date: Tue, 31 Aug 2021 18:35:15 -0400 Subject: [PATCH 3/3] Add some whitespace in the raw html logs --- src/resources/loggingconsole.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/resources/loggingconsole.lua b/src/resources/loggingconsole.lua index 88277cb..222ffab 100644 --- a/src/resources/loggingconsole.lua +++ b/src/resources/loggingconsole.lua @@ -157,8 +157,11 @@ end function LoggingConsole:writeToLog(str) local fileName = self:getFullFilename() self:createPathIfNotExists() - if self:getExtension() == "html" and not io.exists(fileName) then - str = htmlHeader .. str + if self:getExtension() == "html" then + if not io.exists(fileName) then + str = htmlHeader .. str + end + str = str .. "\n" -- html doesn't care about the extra whitespace, but it makes the raw file much easier to read end local file, err = io.open(fileName, "a") if not file then