fix sandbox app script loading and timer execution

- Add relative path resolution for filesystem-loaded documents in kernel.cpp
  - SetDocumentBasePath() tracks document directory for relative resource resolution
  - ResolvePath() resolves relative paths like "app.lua" against document base path
- Fix RmlUi context name lookup in sandbox test app (use "default" not "main")
- Add debug logging to timer_manager.cpp to trace timer creation and execution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 22:10:45 +01:00
parent 8cf24d8c2a
commit 68398e5b60
3 changed files with 109 additions and 15 deletions

View File

@@ -16,11 +16,12 @@ local function getDocument()
currentDocument = document
return document
end
-- Try to get from RmlUi context
if rmlui and rmlui.contexts and rmlui.contexts.main then
local ctx = rmlui.contexts.main
-- documents is a proxy, iterate to get first doc
if ctx.documents then
-- Try to get from RmlUi context (our context is named "default")
if rmlui and rmlui.contexts then
-- Try both "default" and "main" context names
local ctx = rmlui.contexts["default"] or rmlui.contexts.main
if ctx and ctx.documents then
-- documents is a proxy, iterate to get first doc
for i, doc in ipairs(ctx.documents) do
if doc then
currentDocument = doc
@@ -155,7 +156,7 @@ function testCrypto()
-- Test SHA256
if success then
local hash = crypto.sha256("hello world")
local hash = crypto.hash("sha256", "hello world")
if hash then
log("SHA256: " .. hash:sub(1, 32) .. "...")
else