| 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 { |
| 11 String value = _properties[name]; | 11 String value = _properties[name]; |
| 12 if (value != null) { | 12 if (value != null) { |
| 13 return value; | 13 return value; |
| 14 } | 14 } |
| 15 } | 15 } |
| 16 if (name == 'os.name') { | 16 if (name == 'os.name') { |
| 17 return Platform.operatingSystem; | 17 return Platform.operatingSystem; |
| 18 } | 18 } |
| 19 if (name == 'line.separator') { | 19 if (name == 'line.separator') { |
| 20 if (Platform.isWindows) { | 20 if (Platform.isWindows) { |
| 21 return '\r\n'; | 21 return '\r\n'; |
| 22 } | 22 } |
| 23 return '\n'; | 23 return '\n'; |
| 24 } | 24 } |
| 25 if (name == 'com.google.dart.sdk') { | 25 if (name == 'com.google.dart.sdk') { |
| 26 String value = Platform.environment['DART_SDK']; | |
| 27 if (value != null) { | |
| 28 _properties[name] = value; | |
| 29 return value; | |
| 30 } | |
| 31 } | |
| 32 if (name == 'com.google.dart.sdk') { | |
| 33 String exec = Platform.executable; | 26 String exec = Platform.executable; |
| 34 if (exec.length != 0) { | 27 if (exec.length != 0) { |
| 35 String sdkPath; | 28 String sdkPath; |
| 36 // may be "xcodebuild/ReleaseIA32/dart" with "dart-sdk" sibling | 29 // may be "xcodebuild/ReleaseIA32/dart" with "sdk" sibling |
| 37 { | 30 { |
| 38 sdkPath = pathos.join(pathos.dirname(exec), "dart-sdk"); | 31 var outDir = pathos.dirname(pathos.dirname(exec)); |
| 32 sdkPath = pathos.join(pathos.dirname(outDir), "sdk"); |
| 39 if (new Directory(sdkPath).existsSync()) { | 33 if (new Directory(sdkPath).existsSync()) { |
| 40 _properties[name] = sdkPath; | 34 _properties[name] = sdkPath; |
| 41 return sdkPath; | 35 return sdkPath; |
| 42 } | 36 } |
| 43 } | 37 } |
| 44 // probably be "dart-sdk/bin/dart" | 38 // probably be "dart-sdk/bin/dart" |
| 45 sdkPath = pathos.dirname(pathos.dirname(exec)); | 39 sdkPath = pathos.dirname(pathos.dirname(exec)); |
| 46 _properties[name] = sdkPath; | 40 _properties[name] = sdkPath; |
| 47 return sdkPath; | 41 return sdkPath; |
| 48 } | 42 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 var files = <JavaFile>[]; | 117 var files = <JavaFile>[]; |
| 124 var entities = _newDirectory().listSync(); | 118 var entities = _newDirectory().listSync(); |
| 125 for (FileSystemEntity entity in entities) { | 119 for (FileSystemEntity entity in entities) { |
| 126 files.add(new JavaFile(entity.path)); | 120 files.add(new JavaFile(entity.path)); |
| 127 } | 121 } |
| 128 return files; | 122 return files; |
| 129 } | 123 } |
| 130 File _newFile() => new File(_path); | 124 File _newFile() => new File(_path); |
| 131 Directory _newDirectory() => new Directory(_path); | 125 Directory _newDirectory() => new Directory(_path); |
| 132 } | 126 } |
| OLD | NEW |