| OLD | NEW |
| 1 library java.io; | 1 library java.io; |
| 2 | 2 |
| 3 import "dart:io"; | 3 import "dart:io"; |
| 4 | 4 |
| 5 class JavaSystemIO { | 5 class JavaSystemIO { |
| 6 static Map<String, String> _properties = new Map(); | 6 static Map<String, String> _properties = new Map(); |
| 7 static String getProperty(String name) { | 7 static String getProperty(String name) { |
| 8 { | 8 { |
| 9 String value = _properties[name]; | 9 String value = _properties[name]; |
| 10 if (value != null) { | 10 if (value != null) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 class JavaFile { | 58 class JavaFile { |
| 59 static final String separator = Platform.pathSeparator; | 59 static final String separator = Platform.pathSeparator; |
| 60 static final int separatorChar = Platform.pathSeparator.codeUnitAt(0); | 60 static final int separatorChar = Platform.pathSeparator.codeUnitAt(0); |
| 61 Path _path; | 61 Path _path; |
| 62 JavaFile(String path) { | 62 JavaFile(String path) { |
| 63 this._path = new Path(path); | 63 this._path = new Path(path); |
| 64 } | 64 } |
| 65 JavaFile.relative(JavaFile base, String child) { | 65 JavaFile.relative(JavaFile base, String child) { |
| 66 this._path = base._path.join(new Path(child)); | 66 if (child.isEmpty) { |
| 67 this._path = base._path; |
| 68 } else { |
| 69 this._path = base._path.join(new Path(child)); |
| 70 } |
| 67 } | 71 } |
| 68 JavaFile.fromUri(Uri uri) : this(uri.path); | 72 JavaFile.fromUri(Uri uri) : this(uri.path); |
| 69 int get hashCode => _path.hashCode; | 73 int get hashCode => _path.hashCode; |
| 70 bool operator ==(other) { | 74 bool operator ==(other) { |
| 71 return other is JavaFile && other._path.toNativePath() == _path.toNativePath
(); | 75 return other is JavaFile && other._path.toNativePath() == _path.toNativePath
(); |
| 72 } | 76 } |
| 73 String getPath() => _path.toNativePath(); | 77 String getPath() => _path.toNativePath(); |
| 74 String getName() => _path.filename; | 78 String getName() => _path.filename; |
| 75 String getParent() { | 79 String getParent() { |
| 76 var result = _path.directoryPath.toNativePath(); | 80 var result = _path.directoryPath.toNativePath(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 106 List<JavaFile> files = []; | 110 List<JavaFile> files = []; |
| 107 List<FileSystemEntity> entities = _newDirectory().listSync(); | 111 List<FileSystemEntity> entities = _newDirectory().listSync(); |
| 108 for (FileSystemEntity entity in entities) { | 112 for (FileSystemEntity entity in entities) { |
| 109 files.add(new JavaFile(entity.path)); | 113 files.add(new JavaFile(entity.path)); |
| 110 } | 114 } |
| 111 return files; | 115 return files; |
| 112 } | 116 } |
| 113 File _newFile() => new File.fromPath(_path); | 117 File _newFile() => new File.fromPath(_path); |
| 114 Directory _newDirectory() => new Directory.fromPath(_path); | 118 Directory _newDirectory() => new Directory.fromPath(_path); |
| 115 } | 119 } |
| OLD | NEW |