aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/core/init.lua8
-rw-r--r--data/plugins/treeview.lua8
-rw-r--r--lib/dmon/dmon_extra.h4
3 files changed, 9 insertions, 11 deletions
diff --git a/data/core/init.lua b/data/core/init.lua
index aba10d8f..ba53d1a7 100644
--- a/data/core/init.lua
+++ b/data/core/init.lua
@@ -197,14 +197,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
diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua
index ffe93ca5..c6c67177 100644
--- a/data/plugins/treeview.lua
+++ b/data/plugins/treeview.lua
@@ -230,12 +230,14 @@ function TreeView:on_mouse_pressed(button, x, y, clicks)
if keymap.modkeys["ctrl"] and button == "left" then
create_directory_in(hovered_item)
else
- hovered_item.expanded = not hovered_item.expanded
local hovered_dir = core.project_dir_by_name(hovered_item.dir_name)
if hovered_dir and hovered_dir.files_limit then
- core.update_project_subdir(hovered_dir, hovered_item.filename, hovered_item.expanded)
- core.project_subdir_set_show(hovered_dir, hovered_item.filename, hovered_item.expanded)
+ if not core.project_subdir_set_show(hovered_dir, hovered_item.filename, not hovered_item.expanded) then
+ return
+ end
+ core.update_project_subdir(hovered_dir, hovered_item.filename, not hovered_item.expanded)
end
+ hovered_item.expanded = not hovered_item.expanded
end
else
core.try(function()
diff --git a/lib/dmon/dmon_extra.h b/lib/dmon/dmon_extra.h
index 4b321034..cbacdc93 100644
--- a/lib/dmon/dmon_extra.h
+++ b/lib/dmon/dmon_extra.h
@@ -62,7 +62,6 @@ DMON_API_IMPL bool dmon_watch_add(dmon_watch_id id, const char* watchdir)
dmon__strcpy(fullpath, sizeof(fullpath), watch->rootdir);
dmon__strcat(fullpath, sizeof(fullpath), watchdir);
if (stat(fullpath, &st) != 0 || (st.st_mode & S_IFDIR) == 0) {
- _DMON_LOG_ERRORF("Watch directory '%s' is not valid", watchdir);
if (!skip_lock)
pthread_mutex_unlock(&_dmon.mutex);
return false;
@@ -79,7 +78,6 @@ DMON_API_IMPL bool dmon_watch_add(dmon_watch_id id, const char* watchdir)
// check that the directory is not already added
for (int i = 0, c = stb_sb_count(watch->subdirs); i < c; i++) {
if (strcmp(subdir.rootdir, watch->subdirs[i].rootdir) == 0) {
- _DMON_LOG_ERRORF("Error watching directory '%s', because it is already added.", watchdir);
if (!skip_lock)
pthread_mutex_unlock(&_dmon.mutex);
return false;
@@ -92,7 +90,6 @@ DMON_API_IMPL bool dmon_watch_add(dmon_watch_id id, const char* watchdir)
dmon__strcat(fullpath, sizeof(fullpath), subdir.rootdir);
int wd = inotify_add_watch(watch->fd, fullpath, inotify_mask);
if (wd == -1) {
- _DMON_LOG_ERRORF("Error watching directory '%s'. (inotify_add_watch:err=%d)", watchdir, errno);
if (!skip_lock)
pthread_mutex_unlock(&_dmon.mutex);
return false;
@@ -137,7 +134,6 @@ DMON_API_IMPL bool dmon_watch_rm(dmon_watch_id id, const char* watchdir)
}
}
if (i >= c) {
- _DMON_LOG_ERRORF("Watch directory '%s' is not valid", watchdir);
if (!skip_lock)
pthread_mutex_unlock(&_dmon.mutex);
return false;