mirror of
https://github.com/kepler155c/opus
synced 2025-07-05 03:22:52 +00:00
require order issue
This commit is contained in:
parent
f19d439314
commit
852bf3f6a6
@ -1,6 +1,28 @@
|
|||||||
local PASTEBIN_URL = 'http://pastebin.com/raw'
|
local PASTEBIN_URL = 'http://pastebin.com/raw'
|
||||||
local GIT_URL = 'https://raw.githubusercontent.com'
|
local GIT_URL = 'https://raw.githubusercontent.com'
|
||||||
local DEFAULT_PATH = (package and (package.path .. ';') or '?;?.lua;?/init.lua;') .. '/sys/apis/?;/sys/apis/?.lua'
|
|
||||||
|
local function split(str, pattern)
|
||||||
|
local t = { }
|
||||||
|
local function helper(line) table.insert(t, line) return "" end
|
||||||
|
helper((str:gsub(pattern, helper)))
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
local luaPaths = package and package.path and split(package.path, '(.-);') or { }
|
||||||
|
for i = 1, #luaPaths do
|
||||||
|
if luaPaths[i] == '?' or luaPaths[i] == '?.lua' then
|
||||||
|
luaPaths[i] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(luaPaths, 1, '?')
|
||||||
|
table.insert(luaPaths, 2, '?.lua')
|
||||||
|
table.insert(luaPaths, 3, '/usr/apis/?')
|
||||||
|
table.insert(luaPaths, 4, '/usr/apis/?.lua')
|
||||||
|
table.insert(luaPaths, 5, '/sys/apis/?')
|
||||||
|
table.insert(luaPaths, 6, '/sys/apis/?.lua')
|
||||||
|
|
||||||
|
local DEFAULT_PATH = table.concat(luaPaths, ';')
|
||||||
local DEFAULT_BRANCH = _ENV.OPUS_BRANCH or _G.OPUS_BRANCH or 'develop-1.8'
|
local DEFAULT_BRANCH = _ENV.OPUS_BRANCH or _G.OPUS_BRANCH or 'develop-1.8'
|
||||||
local DEFAULT_UPATH = GIT_URL .. '/kepler155c/opus/' .. DEFAULT_BRANCH .. '/sys/apis'
|
local DEFAULT_UPATH = GIT_URL .. '/kepler155c/opus/' .. DEFAULT_BRANCH .. '/sys/apis'
|
||||||
|
|
||||||
|
@ -13,19 +13,19 @@ local helpPaths = Util.split(help.path(), '(.-):')
|
|||||||
|
|
||||||
table.insert(helpPaths, '/sys/help')
|
table.insert(helpPaths, '/sys/help')
|
||||||
|
|
||||||
local function addEntry(t, e)
|
local function addEntry(t, e, n)
|
||||||
for _,v in ipairs(t) do
|
for _,v in ipairs(t) do
|
||||||
if v == e then
|
if v == e then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.insert(t, 1, e)
|
table.insert(t, n or 1, e)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function addRequirePath(t, path)
|
local function addRequirePath(t, path)
|
||||||
addEntry(t, string.format('/%s/?', path))
|
addEntry(t, string.format('/%s/?/init.lua', path), 7)
|
||||||
addEntry(t, string.format('/%s/?.lua', path))
|
addEntry(t, string.format('/%s/?.lua', path), 7)
|
||||||
addEntry(t, string.format('/%s/?/init.lua', path))
|
addEntry(t, string.format('/%s/?', path), 7)
|
||||||
end
|
end
|
||||||
|
|
||||||
for name in pairs(Packages:installed()) do
|
for name in pairs(Packages:installed()) do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user