add standard lua os methods, another fix for vfs links within links, allow write on urlfs mounted files

This commit is contained in:
kepler155c@gmail.com
2020-05-17 19:36:33 -06:00
parent c7c594d6c3
commit a7e3318226
7 changed files with 64 additions and 39 deletions

View File

@@ -5,7 +5,7 @@ local linkfs = { }
-- TODO: implement broken links
local methods = { 'exists', 'getFreeSpace', 'getSize', 'attributes',
'isDir', 'isReadOnly', 'list', 'listEx', 'makeDir', 'open', 'getDrive' }
'isDir', 'isReadOnly', 'list', 'makeDir', 'open', 'getDrive' }
for _,m in pairs(methods) do
linkfs[m] = function(node, dir, ...)
@@ -18,7 +18,7 @@ function linkfs.resolve(node, dir)
return dir:gsub(node.mountPoint, node.source, 1)
end
function linkfs.mount(_, source)
function linkfs.mount(path, source)
if not source then
error('Source is required')
end
@@ -26,6 +26,9 @@ function linkfs.mount(_, source)
if not fs.exists(source) then
error('Source is missing')
end
if path == source then
return
end
if fs.isDir(source) then
return {
source = source,