Skip to content

Commit 2e78c01

Browse files
committed
#462 use required name instead of full path
1 parent 3ee51ba commit 2e78c01

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

Diff for: platform.lua

+15
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,18 @@ else
4141
package.path = rootPath .. script .. '/?.lua'
4242
.. ';' .. rootPath .. script .. '/?/init.lua'
4343
end
44+
45+
package.searchers[2] = function (name)
46+
local filename, err = package.searchpath(name, package.path)
47+
if not filename then
48+
return err
49+
end
50+
local f = io.open(filename)
51+
local buf = f:read '*a'
52+
f:close()
53+
local init, err = load(buf, '@' .. name)
54+
if not init then
55+
return err
56+
end
57+
return init, filename
58+
end

Diff for: script/log.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ m.size = 0
2222
m.maxSize = 100 * 1024 * 1024
2323

2424
local function trimSrc(src)
25-
src = src:sub(m.prefixLen + 3, -5)
26-
src = src:gsub('^[/\\]+', '')
27-
src = src:gsub('[\\/]+', '.')
25+
if src:sub(1, 1) == '@' then
26+
src = src:sub(2)
27+
end
2828
return src
2929
end
3030

0 commit comments

Comments
 (0)