You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Files that do not exist are expected and related exceptions should be
ignored. There are two relevant cases:
scala> java.nio.file.Files.newInputStream(java.nio.file.FileSystems.getDefault().getPath("does-not-exist"))
java.nio.file.NoSuchFileException: does-not-exist
scala> java.nio.file.Files.newInputStream(java.nio.file.FileSystems.getDefault().getPath("regular-file-instead-of-directory/filename"))
java.nio.file.FileSystemException: regular-file-instead-of-directory/filename: Not a directory
Ideally, other I/O errors would be propagated.
However, there is no reliable way to distinguish them based on the
exceptions alone. In particular, the message cannot be checked, because
it depends on the operating system and it is localized.
Just accept this.
0 commit comments