Skip to content
Snippets Groups Projects
Commit 2e78c013 authored by 最萌小汐's avatar 最萌小汐
Browse files

#462 use required name instead of full path

parent 3ee51ba3
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment