diff --git a/data/core/init.lua b/data/core/init.lua index 9ddf68e3..d964b624 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -1123,6 +1123,10 @@ function core.dir_rescan_add_job(dir, filepath) end +function core.on_dirmonitor_modify() +end + + function core.on_dir_change(watch_id, action, filepath) local dir = project_dir_by_watch_id(watch_id) if not dir then return end @@ -1131,6 +1135,9 @@ function core.on_dir_change(watch_id, action, filepath) project_scan_remove_file(dir, filepath) elseif action == "create" then project_scan_add_file(dir, filepath) + core.on_dirmonitor_modify(dir, filepath); + elseif action == "modify" then + core.on_dirmonitor_modify(dir, filepath); end end diff --git a/src/api/system.c b/src/api/system.c index 5b72b4d8..c1a4abd3 100644 --- a/src/api/system.c +++ b/src/api/system.c @@ -240,7 +240,19 @@ top: case SDL_USEREVENT: lua_pushstring(L, "dirchange"); lua_pushnumber(L, e.user.code >> 16); - lua_pushstring(L, (e.user.code & 0xffff) == DMON_ACTION_DELETE ? "delete" : "create"); + switch (e.user.code & 0xffff) { + case DMON_ACTION_DELETE: + lua_pushstring(L, "delete"); + break; + case DMON_ACTION_CREATE: + lua_pushstring(L, "create"); + break; + case DMON_ACTION_MODIFY: + lua_pushstring(L, "modify"); + break; + default: + return luaL_error(L, "unknown dmon event action: %d", e.user.code & 0xffff); + } lua_pushstring(L, e.user.data1); free(e.user.data1); return 4; diff --git a/src/dirmonitor.c b/src/dirmonitor.c index 958d463e..0063e400 100644 --- a/src/dirmonitor.c +++ b/src/dirmonitor.c @@ -52,8 +52,6 @@ void dirmonitor_watch_callback(dmon_watch_id watch_id, dmon_action action, const send_sdl_event(watch_id, DMON_ACTION_DELETE, oldfilepath); send_sdl_event(watch_id, DMON_ACTION_CREATE, filepath); break; - case DMON_ACTION_MODIFY: - break; default: send_sdl_event(watch_id, action, filepath); }