Фикс путей монтирования с одинаковой родительской директорией

This commit is contained in:
IgorTimofeev 2022-07-04 12:49:55 +03:00
parent 5790e91610
commit 2d663fc1ed

View File

@ -47,12 +47,16 @@ end
--------------------------------------- Mounted filesystem support -----------------------------------------
function filesystem.mount(cyka, path)
function filesystem.mount(cyka, path)
if type(cyka) == "table" then
local mountedProxy
for i = 1, #mountedProxies do
if mountedProxies[i].path == path then
mountedProxy = mountedProxies[i]
if mountedProxy.path == path then
return false, "mount path has been taken by other mounted filesystem"
elseif mountedProxies[i].proxy == cyka then
elseif mountedProxy.proxy == cyka then
return false, "proxy is already mounted"
end
end
@ -62,6 +66,8 @@ function filesystem.mount(cyka, path)
proxy = cyka
})
table.sort(mountedProxies, function(a, b) return #b.path < #a.path end)
return true
else
error("bad argument #1 (filesystem proxy expected, got " .. tostring(cyka) .. ")")