Skip to content

Commit f4ce093

Browse files
committed
Get real error
1 parent f308717 commit f4ce093

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

io/src/test/scala/sbt/internal/io/SourceModificationWatchSpec.scala

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -513,16 +513,11 @@ object EventMonitorSpec {
513513
override def toString: String = string
514514
}
515515
}
516-
@tailrec
517516
final def realPath(path: Path, fileName: Option[Path] = None): Path = {
518-
val res: Path =
519-
try path.toRealPath()
520-
catch { case _: IOException => null }
521-
if (res != null) fileName.fold(res)(res.resolve)
522-
else {
523-
val newFileName = path.getFileName
524-
realPath(path.getParent, fileName.map(newFileName.resolve) orElse Some(newFileName))
525-
}
517+
val res =
518+
if (Files.exists(path)) path.toRealPath()
519+
else path.toAbsolutePath()
520+
fileName.fold(res)(res.resolve)
526521
}
527522
def pathFilter(path: Path): FileEvent[?] => Boolean = {
528523
val real = realPath(path)

0 commit comments

Comments
 (0)