From d6e818e648b57d52de31b33096e43483d4134a48 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Fri, 30 Dec 2011 04:05:32 -0200 Subject: [PATCH] fixes for ARM --- modules/client/client.lua | 2 +- modules/core_scripts/util.lua | 17 ++++++++++++++++- src/framework/luafunctions.cpp | 1 - 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/client/client.lua b/modules/client/client.lua index 55a97029..8a7077c5 100644 --- a/modules/client/client.lua +++ b/modules/client/client.lua @@ -4,7 +4,7 @@ Client = { } function Client.init() -- initialize in fullscreen mode on mobile devices if g_window.getPlatformType() == "X11-EGL" then - g_window:setFullscreen(true) + g_window.setFullscreen(true) else g_window.move({ x=220, y=220 }) g_window.resize({ width=800, height=480 }) diff --git a/modules/core_scripts/util.lua b/modules/core_scripts/util.lua index 786a3b01..b7173229 100644 --- a/modules/core_scripts/util.lua +++ b/modules/core_scripts/util.lua @@ -32,10 +32,25 @@ function createEnvironment() return env end +function getCallingScriptSourcePath(depth) + depth = depth or 2 + local info = debug.getinfo(1+depth, "Sn") + local path + if info.short_src then + path = info.short_src:match("(.*)/.*") + end + if not path then + path = '/' + elseif path:sub(0, 1) ~= '/' then + path = '/' .. path + end + return path +end + function resolveFileFullPath(filePath, depth) depth = depth or 1 if filePath:sub(0, 1) ~= '/' then - return getCurrentSourcePath(depth+1) .. '/' .. filePath + return getCallingScriptSourcePath(depth+1) .. '/' .. filePath else return filePath end diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index c3f76ff5..2516e495 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -237,5 +237,4 @@ void Application::registerLuaFunctions() g_lua.bindGlobalFunction("setDefaultFont", std::bind(&FontManager::setDefaultFont, &g_fonts, _1)); g_lua.bindGlobalFunction("loadUI", std::bind(&UIManager::loadUI, &g_ui, _1, _2)); g_lua.bindGlobalFunction("getRootWidget", std::bind(&UIManager::getRootWidget, &g_ui)); - g_lua.bindGlobalFunction("getCurrentSourcePath", std::bind(&LuaInterface::getCurrentSourcePath, &g_lua, _1)); }