Only monitor top level single directory + its children if using --single-directory (Issue #709)

* If --single-directory is being used, and we are using --monitor, only set inotify watches on the single directory
This commit is contained in:
abraunegg 2019-11-02 10:41:18 +11:00 committed by GitHub
parent 7ba59e0b1d
commit 7b4ba2e5d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,17 @@ final class Monitor
fd = inotify_init();
if (fd < 0) throw new MonitorException("inotify_init failed");
if (!buffer) buffer = new void[4096];
addRecursive(".");
// from which point do we start watching for changes?
string monitorPath;
if (cfg.getValueString("single_directory") != ""){
// single directory in use, monitor only this
monitorPath = "./" ~ cfg.getValueString("single_directory");
} else {
// default
monitorPath = ".";
}
addRecursive(monitorPath);
}
void shutdown()