Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support file names that start with uncode characters on linux #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions js/spec/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,39 @@ describe('Node Sentinel File Watcher', function() {
watch = null;
}
});

it('supports watching unicode directories and uncode files', async function() {
const file = 'は.starts_with_unicode';
let eventFound = false;

function findEvent(element) {
if (
element.action === nsfw.actions.CREATED &&
element.directory === watchPath &&
element.file === file
) {
eventFound = true;
}
}

let watch = await nsfw(
workDir,
events => events.forEach(findEvent),
{ debounceMS: DEBOUNCE }
);

try {
await watch.start();
await sleep(TIMEOUT_PER_STEP);
await fse.writeFile(path.join(watchPath, file), 'Unicode though.');
await sleep(TIMEOUT_PER_STEP);

assert.ok(eventFound);
} finally {
await watch.stop();
watch = null;
}
});
});

describe('Garbage collection', function() {
Expand Down
4 changes: 0 additions & 4 deletions src/linux/InotifyEventLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ void InotifyEventLoop::work() {
isDirectoryRemoval = event->mask & (uint32_t)(IN_IGNORED | IN_DELETE_SELF);
isDirectoryEvent = event->mask & (uint32_t)(IN_ISDIR);

if (!isDirectoryRemoval && *event->name <= 31) {
continue;
}

if (event->mask & (uint32_t)(IN_ATTRIB | IN_MODIFY)) {
modify();
} else if (event->mask & (uint32_t)IN_CREATE) {
Expand Down