Refactor linkfs and netfs resolve functions for improved path handling
This commit is contained in:
@@ -35,8 +35,10 @@ end
|
||||
local methods = { 'delete', 'exists', 'getFreeSpace', 'makeDir', 'list', 'listEx', 'attributes' }
|
||||
|
||||
local function resolve(node, dir)
|
||||
-- TODO: Wrong ! (does not support names with dashes)
|
||||
dir = dir:gsub(node.mountPoint, '', 1)
|
||||
local mp = node.mountPoint
|
||||
if dir:sub(1, #mp) == mp then
|
||||
dir = dir:sub(#mp + 1)
|
||||
end
|
||||
return fs.combine(node.source, dir)
|
||||
end
|
||||
|
||||
@@ -53,7 +55,7 @@ end
|
||||
|
||||
function netfs.mount(_, id, source)
|
||||
if not id or not tonumber(id) then
|
||||
error('ramfs syntax: computerId [directory]')
|
||||
error('netfs syntax: computerId [directory]')
|
||||
end
|
||||
return {
|
||||
id = tonumber(id),
|
||||
|
||||
Reference in New Issue
Block a user