From 2d663fc1edff2de26fc2e9271e52ed322429f05d Mon Sep 17 00:00:00 2001 From: IgorTimofeev Date: Mon, 4 Jul 2022 12:49:55 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BF=D1=83=D1=82?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=BC=D0=BE=D0=BD=D1=82=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D1=81=20=D0=BE=D0=B4=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=D0=BA=D0=BE=D0=B2=D0=BE=D0=B9=20=D1=80=D0=BE=D0=B4=D0=B8?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8C=D1=81=D0=BA=D0=BE=D0=B9=20=D0=B4=D0=B8?= =?UTF-8?q?=D1=80=D0=B5=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Libraries/Filesystem.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Libraries/Filesystem.lua b/Libraries/Filesystem.lua index f0e15014..1b12dd2f 100644 --- a/Libraries/Filesystem.lua +++ b/Libraries/Filesystem.lua @@ -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) .. ")")