OLD | NEW |
1 library java.io; | 1 library java.io; |
2 | 2 |
3 import "dart:io"; | 3 import "dart:io"; |
4 import 'java_core.dart' show JavaIOException; | 4 import 'java_core.dart' show JavaIOException; |
5 import 'package:path/path.dart' as pathos; | 5 import 'package:path/path.dart' as pathos; |
6 | 6 |
7 class JavaSystemIO { | 7 class JavaSystemIO { |
8 static Map<String, String> _properties = new Map(); | 8 static Map<String, String> _properties = new Map(); |
9 static String getProperty(String name) { | 9 static String getProperty(String name) { |
10 { | 10 { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return result; | 86 return result; |
87 } | 87 } |
88 JavaFile getParentFile() { | 88 JavaFile getParentFile() { |
89 var parent = getParent(); | 89 var parent = getParent(); |
90 if (parent == null) return null; | 90 if (parent == null) return null; |
91 return new JavaFile(parent); | 91 return new JavaFile(parent); |
92 } | 92 } |
93 String getAbsolutePath() => pathos.absolute(_path); | 93 String getAbsolutePath() => pathos.absolute(_path); |
94 String getCanonicalPath() { | 94 String getCanonicalPath() { |
95 try { | 95 try { |
96 return _newFile().fullPathSync(); | 96 return _newFile().resolveSymbolicLinksSync(); |
97 } catch (e) { | 97 } catch (e) { |
98 throw new JavaIOException('IOException', e); | 98 throw new JavaIOException('IOException', e); |
99 } | 99 } |
100 } | 100 } |
101 JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath()); | 101 JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath()); |
102 JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath()); | 102 JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath()); |
103 bool exists() { | 103 bool exists() { |
104 if (_newFile().existsSync()) { | 104 if (_newFile().existsSync()) { |
105 return true; | 105 return true; |
106 } | 106 } |
(...skipping 16 matching lines...) Expand all Loading... |
123 var files = <JavaFile>[]; | 123 var files = <JavaFile>[]; |
124 var entities = _newDirectory().listSync(); | 124 var entities = _newDirectory().listSync(); |
125 for (FileSystemEntity entity in entities) { | 125 for (FileSystemEntity entity in entities) { |
126 files.add(new JavaFile(entity.path)); | 126 files.add(new JavaFile(entity.path)); |
127 } | 127 } |
128 return files; | 128 return files; |
129 } | 129 } |
130 File _newFile() => new File(_path); | 130 File _newFile() => new File(_path); |
131 Directory _newDirectory() => new Directory(_path); | 131 Directory _newDirectory() => new Directory(_path); |
132 } | 132 } |
OLD | NEW |