From 26682daa96807705a6f4fad7993529c55a0f9e4e Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Sun, 28 Nov 2021 03:35:28 +0100 Subject: [PATCH] Added comments & improved logs --- src/main/kotlin/app/git/FileChangesWatcher.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/app/git/FileChangesWatcher.kt b/src/main/kotlin/app/git/FileChangesWatcher.kt index 3017ce3..847529f 100644 --- a/src/main/kotlin/app/git/FileChangesWatcher.kt +++ b/src/main/kotlin/app/git/FileChangesWatcher.kt @@ -21,7 +21,7 @@ class FileChangesWatcher @Inject constructor() { ENTRY_MODIFY ) - // register directory and sub-directories + // register directory and sub-directories but ignore dirs by gitignore Files.walkFileTree(path, object : SimpleFileVisitor() { @Throws(IOException::class) override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult { @@ -40,10 +40,7 @@ class FileChangesWatcher @Inject constructor() { while (watchService.take().also { key = it } != null) { this.emit(Unit) for (event: WatchEvent<*> in key.pollEvents()) { - println( - "Event kind:" + event.kind() - + ". File affected: " + event.context() + "." - ) + println("Event kind: ${event.kind()}. File affected: ${event.context()}.") } key.reset() }