From 917d721acdf86ff69728fae89662019c519ea561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 22 Oct 2019 15:12:12 +0800 Subject: =?UTF-8?q?=E9=81=8D=E5=8E=86=E7=9B=AE=E5=BD=95=E5=9C=A8=E4=B8=BB?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E4=B8=AD=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/workspace/workspace.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'server-beta') diff --git a/server-beta/src/workspace/workspace.lua b/server-beta/src/workspace/workspace.lua index 70334134..7f2998be 100644 --- a/server-beta/src/workspace/workspace.lua +++ b/server-beta/src/workspace/workspace.lua @@ -92,7 +92,7 @@ function m.preload() local ignore = m.getIgnoreMatcher() ignore:setInterface('type', function (path) - if pub.task('isDirectory', furi.encode(m.path .. '/' .. path)) then + if fs.is_directory(fs.path(m.path .. '/' .. path)) then return 'directory' else return 'file' @@ -100,10 +100,9 @@ function m.preload() end) ignore:setInterface('list', function (path) - local uris = pub.task('listDirectory', furi.encode(m.path .. '/' .. path)) local paths = {} - for i, uri in ipairs(uris) do - paths[i] = furi.decode(uri) + for fullpath in fs.path(m.path .. '/' .. path):list_directory() do + paths[#paths+1] = fullpath:string() end return paths end) @@ -124,12 +123,10 @@ function m.preload() log.info(('Found %d files.'):format(max)) while true do log.info(('Loaded %d/%d files'):format(read, max)) - if read < max then - task.sleep(0.1) - goto CONTINUE + if read >= max then + break end - break - ::CONTINUE:: + task.sleep(0.1) end log.info('Preload finish.') -- cgit v1.2.3