Skip to content

Commit 514403f

Browse files
committed
improve filewatch
#1872
1 parent 42bad3f commit 514403f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

script/workspace/workspace.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,11 @@ function m.awaitPreload(scp)
307307

308308
if scp.uri and not scp:get('bad root') then
309309
log.info('Scan files at:', scp:getName())
310-
---@async
311310
scp:gc(fw.watch(m.normalize(furi.decode(scp.uri)), true, function (path)
312-
local uri = furi.encode(path)
313-
if m.isIgnored(uri) and not files.isLibrary(uri) then
311+
local rpath = m.getRelativePath(path)
312+
if native(rpath) then
314313
return false
315314
end
316-
await.delay()
317315
return true
318316
end))
319317
local count = 0
@@ -333,13 +331,11 @@ function m.awaitPreload(scp)
333331
for _, libMatcher in ipairs(librarys) do
334332
log.info('Scan library at:', libMatcher.uri)
335333
local count = 0
336-
---@async
337334
scp:gc(fw.watch(furi.decode(libMatcher.uri), true, function (path)
338-
local uri = furi.encode(path)
339-
if m.isIgnored(uri) and not files.isLibrary(uri) then
335+
local rpath = m.getRelativePath(path)
336+
if libMatcher.matcher(rpath) then
340337
return false
341338
end
342-
await.delay()
343339
return true
344340
end))
345341
scp:addLink(libMatcher.uri)

0 commit comments

Comments
 (0)