Check if ignore::Walk would ignore a path? #3060
-
Hello, I'm trying to build a small application that syncs my files with a cloud storage solution. I want the program to respect .ignore and .gitignore. I'm using the notify crate to look for changes in the target dir. To reduce issues with inotify limitations, I thought of using ignore's walk to watch only files and dirs that aren't ignored. Additionally, when a new file/dir is created, I would like to check if the walker would have ignored this file (to avoid unnecessary sync). Is there a way to check if the walker would have ignored the entry? As I understand this is not possible at least using the available public functions of the walk builder and walk. The walker's ability to look at parent ignore rules and other checks (max size, trivial ignores) can be replicated manually, but I think it would make sense to have direct access which would ensure that the same set of rules are being followed everywhere. I tried looking for a solution online, wasn't able to find anything. Please excuse me if it turns out that I just didn't look hard enough. Any suggestions would be much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The only way it's to re-walk the directory. The implementation isn't setup to be used in the way you want. |
Beta Was this translation helpful? Give feedback.
The only way it's to re-walk the directory. The implementation isn't setup to be used in the way you want.