Refactor linkfs and netfs resolve functions for improved path handling

This commit is contained in:
MayaTheShy
2026-03-22 04:09:43 -04:00
parent ba49f7ca7d
commit 882894685c
2 changed files with 21 additions and 11 deletions

View File

@@ -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),