@@ -235,22 +235,21 @@ abstract class AbstractFile extends Iterable[AbstractFile] {
235
235
file
236
236
}
237
237
238
- private def fileOrSubdirectoryNamed (name : String , isDir : Boolean ): AbstractFile = {
239
- val lookup = lookupName(name, isDir)
240
- if (lookup != null ) lookup
241
- else {
242
- // the optional exception may be thrown for symlinks, notably /tmp on MacOS .
243
- // isDirectory tests for existing directory. The default behavior is hypothetical isDirectory (jpath, FOLLOW_LINKS).
244
- try Files .createDirectories (jpath)
245
- catch { case _ : FileAlreadyExistsException if Files .isDirectory(jpath) => }
246
-
247
- // a race condition in creating the entry after the failed lookup may throw
248
- val path = jpath.resolve(name )
249
- if (isDir) Files .createDirectory (path)
250
- else Files .createFile( path)
251
- new PlainFile ( new File (path))
238
+ private def fileOrSubdirectoryNamed (name : String , isDir : Boolean ): AbstractFile =
239
+ lookupName(name, isDir) match {
240
+ case null =>
241
+ // the optional exception may be thrown for symlinks, notably /tmp on MacOS.
242
+ // isDirectory tests for existing directory. The default behavior is hypothetical isDirectory(jpath, FOLLOW_LINKS) .
243
+ try Files .createDirectories (jpath)
244
+ catch { case _ : FileAlreadyExistsException if Files .isDirectory (jpath) => }
245
+
246
+ // a race condition in creating the entry after the failed lookup may throw
247
+ val path = jpath.resolve(name)
248
+ if (isDir) Files .createDirectory(path )
249
+ else Files .createFile (path)
250
+ new PlainFile ( new File ( path) )
251
+ case lookup => lookup
252
252
}
253
- }
254
253
255
254
/**
256
255
* Get the file in this directory with the given name,
0 commit comments