@@ -13,9 +13,8 @@ import java.nio.file.{InvalidPathException, Paths}
13
13
14
14
/** ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' */
15
15
class PlainDirectory (givenPath : Directory ) extends PlainFile (givenPath) {
16
- override def isDirectory : Boolean = true
16
+ override val isDirectory : Boolean = true
17
17
override def iterator (): Iterator [PlainFile ] = givenPath.list.filter(_.exists).map(new PlainFile (_))
18
- override def delete (): Unit = givenPath.deleteRecursively()
19
18
}
20
19
21
20
/** This class implements an abstract file backed by a File.
@@ -78,7 +77,7 @@ class PlainFile(val givenPath: Path) extends AbstractFile {
78
77
}
79
78
80
79
/** Is this abstract file a directory? */
81
- def isDirectory : Boolean = givenPath.isDirectory
80
+ val isDirectory : Boolean = givenPath.isDirectory // cached for performance on Windows
82
81
83
82
/** Returns the time that this abstract file was last modified. */
84
83
def lastModified : Long = givenPath.lastModified.toMillis
@@ -113,14 +112,6 @@ class PlainFile(val givenPath: Path) extends AbstractFile {
113
112
null
114
113
}
115
114
116
- /** Does this abstract file denote an existing file? */
117
- def create (): Unit = if (! exists) givenPath.createFile()
118
-
119
- /** Delete the underlying file or directory (recursively). */
120
- def delete (): Unit =
121
- if (givenPath.isFile) givenPath.delete()
122
- else if (givenPath.isDirectory) givenPath.toDirectory.deleteRecursively()
123
-
124
115
/** Returns a plain file with the given name. It does not
125
116
* check that it exists.
126
117
*/
0 commit comments