macOS - improve demangle
to emit create events
#149
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #31
The current implementation of
demangle
has a flaw: some operations from the macOS finder can result in thebirthtime
getting restored as it was (e.g. undo a delete or copy a folder). As such,nsfw
often would wrongly only send a change event when it is a create event.For some operations we can tell that the event should be create, so a boolean flag is added. The current behaviour of sending a change event is still preserved, so we might be ending up sending one event too much, but I think that is totally fine.
This slightly improves the situation for #146 in that a create event is fired for the renamed file, though we miss the delete event. I think detecting a case rename will probably be tricky for
demangle
because the stat check will not figure out that the old name was removed from disk.