refactor: add watches for newly created directories
This commit is contained in:
parent
311209649f
commit
7dce0b0572
1 changed files with 5 additions and 0 deletions
|
|
@ -594,12 +594,17 @@ const Process = struct {
|
||||||
|
|
||||||
fn handle_file_watch_event(self: *Process, abs_path: []const u8, event_type: file_watcher.EventType) void {
|
fn handle_file_watch_event(self: *Process, abs_path: []const u8, event_type: file_watcher.EventType) void {
|
||||||
std.log.debug("file_watch_event: {s} {s}", .{ @tagName(event_type), abs_path });
|
std.log.debug("file_watch_event: {s} {s}", .{ @tagName(event_type), abs_path });
|
||||||
|
if (event_type == .dir_created) {
|
||||||
|
file_watcher.watch(abs_path) catch |e| self.logger.err("file_watcher.watch(dir_created)", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (self.project_for_path(abs_path)) |match| {
|
if (self.project_for_path(abs_path)) |match| {
|
||||||
switch (event_type) {
|
switch (event_type) {
|
||||||
.created => match.project.file_added(match.rel_path) catch |e| self.logger.err("file_watcher.file_added", e),
|
.created => match.project.file_added(match.rel_path) catch |e| self.logger.err("file_watcher.file_added", e),
|
||||||
.modified => match.project.file_modified(match.rel_path),
|
.modified => match.project.file_modified(match.rel_path),
|
||||||
.deleted => match.project.file_deleted(match.rel_path),
|
.deleted => match.project.file_deleted(match.rel_path),
|
||||||
.renamed => match.project.file_deleted(match.rel_path),
|
.renamed => match.project.file_deleted(match.rel_path),
|
||||||
|
.dir_created => unreachable,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.parent.send(.{ "FW", "change", abs_path, event_type }) catch {};
|
self.parent.send(.{ "FW", "change", abs_path, event_type }) catch {};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue