remove preferred apps/alternates - same can be accomplished using aliases

This commit is contained in:
kepler155c@gmail.com
2020-06-15 19:54:42 -06:00
parent 156b604a58
commit 42bd4b2b69
8 changed files with 64 additions and 151 deletions

View File

@@ -79,10 +79,40 @@ function ramfs.list(node, dir)
end
function ramfs.open(node, fn, fl)
if fl ~= 'r' and fl ~= 'w' and fl ~= 'rb' and fl ~= 'wb' then
local modes = Util.transpose { 'r', 'w', 'rb', 'wb', 'a' }
if not modes[fl] then
error('Unsupported mode')
end
if fl == 'a' then
if node.mountPoint ~= fn then
fl = 'w'
else
local c = type(node.contents) == 'table'
and string.char(table.unpack(node.contents))
or node.contents
or ''
return {
write = function(str)
c = c .. str
end,
writeLine = function(str)
c = c .. str .. '\n'
end,
flush = function()
node.contents = c
node.size = #c
end,
close = function()
node.contents = c
node.size = #c
c = nil
end,
}
end
end
if fl == 'r' then
if node.mountPoint ~= fn then
return