Skip to content

Commit

Permalink
fix scriptFileWatcher
Browse files Browse the repository at this point in the history
Signed-off-by: Jan N. Klug <github@klug.nrw>
  • Loading branch information
J-N-K committed Aug 7, 2022
1 parent b35377b commit 8251fdb
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,14 @@ private void importResources(File file) {
@Override
public void processWatchEvent(WatchService.Kind kind, Path path) {
try {
if (!Files.isHidden(path)) {
URL fileUrl = path.toUri().toURL();
Path absolutePath = watchPath.resolve(path);
if (!Files.isHidden(absolutePath)) {
URL fileUrl = absolutePath.toUri().toURL();
if (kind == WatchService.Kind.DELETE) {
removeFile(new ScriptFileReference(fileUrl));
}

if (Files.isReadable(watchPath.resolve(path))
if (Files.isReadable(absolutePath)
&& (kind == WatchService.Kind.CREATE || kind == WatchService.Kind.MODIFY)) {
importFileWhenReady(new ScriptFileReference(fileUrl));
}
Expand Down

0 comments on commit 8251fdb

Please sign in to comment.