moonscript support + cleanup

This commit is contained in:
kepler155c@gmail.com 2020-06-05 21:38:26 -06:00
parent e7fcd68a0f
commit 6c5cc508b1
4 changed files with 15 additions and 11 deletions

View File

@ -1,9 +1,9 @@
local BulkGet = require('opus.bulkget')
local Config = require('opus.config')
local Git = require('opus.git')
local LZW = require('opus.compress.lzw')
local LZW = require('opus.compress.lzw')
local Packages = require('opus.packages')
local Tar = require('opus.compress.tar')
local Tar = require('opus.compress.tar')
local Util = require('opus.util')
local fs = _G.fs

View File

@ -109,6 +109,9 @@ function urlfs.open(node, fn, fl)
}
end
return {
readAll = function()
return c
end,
read = function()
ctr = ctr + 1
return c:sub(ctr, ctr):byte()

View File

@ -43,9 +43,9 @@ return function(env)
return env.package.preload[modname](modname, env)
end
end
end
--end
local function loadedSearcher(modname)
--local function loadedSearcher(modname)
if env.package.loaded[modname] then
return function()
return env.package.loaded[modname]
@ -95,7 +95,7 @@ return function(env)
},
loaders = {
preloadSearcher,
loadedSearcher,
--loadedSearcher,
pathSearcher,
}
}
@ -104,10 +104,8 @@ return function(env)
for _,searcher in ipairs(env.package.loaders) do
local fn, msg = searcher(modname)
if fn then
local module, msg2 = fn(modname, env)
if not module then
error(msg2 or (modname .. ' module returned nil'), 2)
end
local module = fn(modname, env) or true
env.package.loaded[modname] = module
return module
end

View File

@ -64,8 +64,11 @@ function UI.QuickSelect:enable()
local files = fs.list(dir)
for _,f in ipairs(files) do
local fullName = fs.combine(dir, f)
if fs.native.isDir(fullName) then -- skip virtual dirs
if f ~= '.git' then recurse(fullName) end
if fs.isDir(fullName) then
-- skip virtual dirs
if f ~= '.git' and fs.native.isDir(fullName) then
recurse(fullName)
end
else
_insert(self.grid.values, {
name = f,