summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform.lua15
-rw-r--r--script/log.lua6
2 files changed, 18 insertions, 3 deletions
diff --git a/platform.lua b/platform.lua
index 6c9d7c09..eb318a84 100644
--- a/platform.lua
+++ b/platform.lua
@@ -41,3 +41,18 @@ else
package.path = rootPath .. script .. '/?.lua'
.. ';' .. rootPath .. script .. '/?/init.lua'
end
+
+package.searchers[2] = function (name)
+ local filename, err = package.searchpath(name, package.path)
+ if not filename then
+ return err
+ end
+ local f = io.open(filename)
+ local buf = f:read '*a'
+ f:close()
+ local init, err = load(buf, '@' .. name)
+ if not init then
+ return err
+ end
+ return init, filename
+end
diff --git a/script/log.lua b/script/log.lua
index 06c5d30c..c3bf02d4 100644
--- a/script/log.lua
+++ b/script/log.lua
@@ -22,9 +22,9 @@ m.size = 0
m.maxSize = 100 * 1024 * 1024
local function trimSrc(src)
- src = src:sub(m.prefixLen + 3, -5)
- src = src:gsub('^[/\\]+', '')
- src = src:gsub('[\\/]+', '.')
+ if src:sub(1, 1) == '@' then
+ src = src:sub(2)
+ end
return src
end