Added comments & improved logs
This commit is contained in:
parent
239d004b84
commit
26682daa96
1 changed files with 2 additions and 5 deletions
|
@ -21,7 +21,7 @@ class FileChangesWatcher @Inject constructor() {
|
||||||
ENTRY_MODIFY
|
ENTRY_MODIFY
|
||||||
)
|
)
|
||||||
|
|
||||||
// register directory and sub-directories
|
// register directory and sub-directories but ignore dirs by gitignore
|
||||||
Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {
|
Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
|
override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
|
||||||
|
@ -40,10 +40,7 @@ class FileChangesWatcher @Inject constructor() {
|
||||||
while (watchService.take().also { key = it } != null) {
|
while (watchService.take().also { key = it } != null) {
|
||||||
this.emit(Unit)
|
this.emit(Unit)
|
||||||
for (event: WatchEvent<*> in key.pollEvents()) {
|
for (event: WatchEvent<*> in key.pollEvents()) {
|
||||||
println(
|
println("Event kind: ${event.kind()}. File affected: ${event.context()}.")
|
||||||
"Event kind:" + event.kind()
|
|
||||||
+ ". File affected: " + event.context() + "."
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
key.reset()
|
key.reset()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue