fix(windows): ignore events with invalid utf-16 paths instead of reporting them with the wrong path
This commit is contained in:
parent
00140fcfe6
commit
8e307e5863
1 changed files with 5 additions and 1 deletions
|
|
@ -140,7 +140,11 @@ fn thread_fn(
|
||||||
const info: *FILE_NOTIFY_INFORMATION = @ptrCast(@alignCast(w.buf[offset..].ptr));
|
const info: *FILE_NOTIFY_INFORMATION = @ptrCast(@alignCast(w.buf[offset..].ptr));
|
||||||
const name_wchars = (&info.FileName).ptr[0 .. info.FileNameLength / 2];
|
const name_wchars = (&info.FileName).ptr[0 .. info.FileNameLength / 2];
|
||||||
var name_buf: [std.fs.max_path_bytes]u8 = undefined;
|
var name_buf: [std.fs.max_path_bytes]u8 = undefined;
|
||||||
const name_len = std.unicode.utf16LeToUtf8(&name_buf, name_wchars) catch 0;
|
const name_len = std.unicode.utf16LeToUtf8(&name_buf, name_wchars) catch {
|
||||||
|
if (info.NextEntryOffset == 0) break;
|
||||||
|
offset += info.NextEntryOffset;
|
||||||
|
continue;
|
||||||
|
};
|
||||||
const event_type: EventType = switch (info.Action) {
|
const event_type: EventType = switch (info.Action) {
|
||||||
FILE_ACTION_ADDED => .created,
|
FILE_ACTION_ADDED => .created,
|
||||||
FILE_ACTION_REMOVED => .deleted,
|
FILE_ACTION_REMOVED => .deleted,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue