File tree 2 files changed +7
-6
lines changed
compiler/src/dotty/tools/io 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ abstract class AbstractFile extends Iterable[AbstractFile] {
121
121
122
122
/** Does this abstract file denote an existing file? */
123
123
def exists : Boolean = {
124
- (jpath eq null ) || Files . exists(jpath)
124
+ (jpath eq null ) || jpath.toFile. exists
125
125
}
126
126
127
127
/** Does this abstract file represent something which can contain classfiles? */
Original file line number Diff line number Diff line change @@ -54,8 +54,9 @@ object Path {
54
54
55
55
def apply (path : String ): Path = apply(Paths .get(path))
56
56
def apply (jpath : JPath ): Path = try {
57
- if (Files .isRegularFile(jpath)) new File (jpath)
58
- else if (Files .isDirectory(jpath)) new Directory (jpath)
57
+ val jfile = jpath.toFile
58
+ if (jfile.isFile) new File (jpath)
59
+ else if (jfile.isDirectory) new Directory (jpath)
59
60
else new Path (jpath)
60
61
} catch { case ex : SecurityException => new Path (jpath) }
61
62
@@ -160,10 +161,10 @@ class Path private[io] (val jpath: JPath) {
160
161
// Boolean tests
161
162
def canRead : Boolean = Files .isReadable(jpath)
162
163
def canWrite : Boolean = Files .isWritable(jpath)
163
- def exists : Boolean = try Files . exists(jpath) catch { case ex : SecurityException => false }
164
- def isFile : Boolean = try Files .isRegularFile( jpath) catch { case ex : SecurityException => false }
164
+ def exists : Boolean = try jpath.toFile. exists catch { case ex : SecurityException => false }
165
+ def isFile : Boolean = try jpath.toFile.isFile catch { case ex : SecurityException => false }
165
166
def isDirectory : Boolean =
166
- try Files . isDirectory(jpath)
167
+ try jpath.toFile. isDirectory
167
168
catch { case ex : SecurityException => jpath.toString == " ." }
168
169
def isAbsolute : Boolean = jpath.isAbsolute()
169
170
def isEmpty : Boolean = path.length == 0
You can’t perform that action at this time.
0 commit comments