mirror of https://github.com/kepler155c/opus
moonscript support + cleanup
This commit is contained in:
parent
e7fcd68a0f
commit
6c5cc508b1
|
@ -1,9 +1,9 @@
|
||||||
local BulkGet = require('opus.bulkget')
|
local BulkGet = require('opus.bulkget')
|
||||||
local Config = require('opus.config')
|
local Config = require('opus.config')
|
||||||
local Git = require('opus.git')
|
local Git = require('opus.git')
|
||||||
local LZW = require('opus.compress.lzw')
|
local LZW = require('opus.compress.lzw')
|
||||||
local Packages = require('opus.packages')
|
local Packages = require('opus.packages')
|
||||||
local Tar = require('opus.compress.tar')
|
local Tar = require('opus.compress.tar')
|
||||||
local Util = require('opus.util')
|
local Util = require('opus.util')
|
||||||
|
|
||||||
local fs = _G.fs
|
local fs = _G.fs
|
||||||
|
|
|
@ -109,6 +109,9 @@ function urlfs.open(node, fn, fl)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
|
readAll = function()
|
||||||
|
return c
|
||||||
|
end,
|
||||||
read = function()
|
read = function()
|
||||||
ctr = ctr + 1
|
ctr = ctr + 1
|
||||||
return c:sub(ctr, ctr):byte()
|
return c:sub(ctr, ctr):byte()
|
||||||
|
|
|
@ -43,9 +43,9 @@ return function(env)
|
||||||
return env.package.preload[modname](modname, env)
|
return env.package.preload[modname](modname, env)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
--end
|
||||||
|
|
||||||
local function loadedSearcher(modname)
|
--local function loadedSearcher(modname)
|
||||||
if env.package.loaded[modname] then
|
if env.package.loaded[modname] then
|
||||||
return function()
|
return function()
|
||||||
return env.package.loaded[modname]
|
return env.package.loaded[modname]
|
||||||
|
@ -95,7 +95,7 @@ return function(env)
|
||||||
},
|
},
|
||||||
loaders = {
|
loaders = {
|
||||||
preloadSearcher,
|
preloadSearcher,
|
||||||
loadedSearcher,
|
--loadedSearcher,
|
||||||
pathSearcher,
|
pathSearcher,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,10 +104,8 @@ return function(env)
|
||||||
for _,searcher in ipairs(env.package.loaders) do
|
for _,searcher in ipairs(env.package.loaders) do
|
||||||
local fn, msg = searcher(modname)
|
local fn, msg = searcher(modname)
|
||||||
if fn then
|
if fn then
|
||||||
local module, msg2 = fn(modname, env)
|
local module = fn(modname, env) or true
|
||||||
if not module then
|
|
||||||
error(msg2 or (modname .. ' module returned nil'), 2)
|
|
||||||
end
|
|
||||||
env.package.loaded[modname] = module
|
env.package.loaded[modname] = module
|
||||||
return module
|
return module
|
||||||
end
|
end
|
||||||
|
|
|
@ -64,8 +64,11 @@ function UI.QuickSelect:enable()
|
||||||
local files = fs.list(dir)
|
local files = fs.list(dir)
|
||||||
for _,f in ipairs(files) do
|
for _,f in ipairs(files) do
|
||||||
local fullName = fs.combine(dir, f)
|
local fullName = fs.combine(dir, f)
|
||||||
if fs.native.isDir(fullName) then -- skip virtual dirs
|
if fs.isDir(fullName) then
|
||||||
if f ~= '.git' then recurse(fullName) end
|
-- skip virtual dirs
|
||||||
|
if f ~= '.git' and fs.native.isDir(fullName) then
|
||||||
|
recurse(fullName)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
_insert(self.grid.values, {
|
_insert(self.grid.values, {
|
||||||
name = f,
|
name = f,
|
||||||
|
|
Loading…
Reference in New Issue