Skip to content

Commit e1fdcd3

Browse files
committed
Handle cases for when a swoval PathWatchers.Event's RelPath has no last segment available
(cherry picked from commit fd24dab)
1 parent ecf3779 commit e1fdcd3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/build/src/main/scala/scala/build/Build.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,9 @@ object Build {
705705
val p = os.Path(event.getTypedPath.getPath.toAbsolutePath)
706706
val relPath = p.relativeTo(d.path)
707707
val isHidden = relPath.segments.exists(_.startsWith("."))
708-
def isScalaFile = relPath.last.endsWith(".sc") || relPath.last.endsWith(".scala")
709-
def isJavaFile = relPath.last.endsWith(".java")
708+
val pathLast = relPath.lastOpt.orElse(p.lastOpt).getOrElse("")
709+
def isScalaFile = pathLast.endsWith(".sc") || pathLast.endsWith(".scala")
710+
def isJavaFile = pathLast.endsWith(".java")
710711
!isHidden && (isScalaFile || isJavaFile)
711712
case _ => _ => true
712713
}

0 commit comments

Comments
 (0)