Fix undue asserts in dmon_extra

Some asserts are placed in case that can effectively occur
so we remove the assertion and we return false. In turn we
adapt the logic accordingly so when false is returned to add
a watch we do not open that directory.
This commit is contained in:
Francesco Abbate
2022-01-09 23:26:11 +01:00
parent 5032e7352e
commit 7473fbf32c
3 changed files with 9 additions and 11 deletions
+4 -4
View File
@@ -224,14 +224,14 @@ end
function core.project_subdir_set_show(dir, filename, show)
dir.shown_subdir[filename] = show
if dir.files_limit and not dir.force_rescan then
local fullpath = dir.name .. PATHSEP .. filename
local success = (show and system.watch_dir_add or system.watch_dir_rm)(dir.watch_id, fullpath)
if not success then
core.log("Internal warning: error calling system.watch_dir_%s", show and "add" or "rm")
if not (show and system.watch_dir_add or system.watch_dir_rm)(dir.watch_id, fullpath) then
return false
end
end
dir.shown_subdir[filename] = show
return true
end