| 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 // print('getProperty[$name].1: $value'); | |
| 13 if (value != null) { | 12 if (value != null) { |
| 14 return value; | 13 return value; |
| 15 } | 14 } |
| 16 } | 15 } |
| 17 if (name == 'os.name') { | 16 if (name == 'os.name') { |
| 18 return Platform.operatingSystem; | 17 return Platform.operatingSystem; |
| 19 } | 18 } |
| 20 if (name == 'line.separator') { | 19 if (name == 'line.separator') { |
| 21 if (Platform.isWindows) { | 20 if (Platform.isWindows) { |
| 22 return '\r\n'; | 21 return '\r\n'; |
| 23 } | 22 } |
| 24 return '\n'; | 23 return '\n'; |
| 25 } | 24 } |
| 26 if (name == 'com.google.dart.sdk') { | 25 if (name == 'com.google.dart.sdk') { |
| 27 String value = Platform.environment['DART_SDK']; | |
| 28 print(Platform.environment); | |
| 29 print('current: ${pathos.current}'); | |
| 30 print('exec: ${Platform.executable}'); | |
| 31 print('execDir: ${pathos.dirname(Platform.executable)}'); | |
| 32 print('getProperty[$name].2: $value'); | |
| 33 // throw ""; | |
| 34 // if (value != null) { | |
| 35 // _properties[name] = value; | |
| 36 // return value; | |
| 37 // } | |
| 38 } | |
| 39 if (name == 'com.google.dart.sdk') { | |
| 40 String exec = Platform.executable; | 26 String exec = Platform.executable; |
| 41 if (exec.length != 0) { | 27 if (exec.length != 0) { |
| 42 String sdkPath; | 28 String sdkPath; |
| 43 // may be "xcodebuild/ReleaseIA32/dart" with "sdk" sibling | 29 // may be "xcodebuild/ReleaseIA32/dart" with "sdk" sibling |
| 44 { | 30 { |
| 45 var outDir = pathos.dirname(pathos.dirname(exec)); | 31 var outDir = pathos.dirname(pathos.dirname(exec)); |
| 46 sdkPath = pathos.join(pathos.dirname(outDir), "sdk"); | 32 sdkPath = pathos.join(pathos.dirname(outDir), "sdk"); |
| 47 if (new Directory(sdkPath).existsSync()) { | 33 if (new Directory(sdkPath).existsSync()) { |
| 48 _properties[name] = sdkPath; | 34 _properties[name] = sdkPath; |
| 49 print('sdkPath.2: $sdkPath'); | |
| 50 return sdkPath; | 35 return sdkPath; |
| 51 } | 36 } |
| 52 } | 37 } |
| 53 // probably be "dart-sdk/bin/dart" | 38 // probably be "dart-sdk/bin/dart" |
| 54 sdkPath = pathos.dirname(pathos.dirname(exec)); | 39 sdkPath = pathos.dirname(pathos.dirname(exec)); |
| 55 print('sdkPath.3: $sdkPath'); | |
| 56 _properties[name] = sdkPath; | 40 _properties[name] = sdkPath; |
| 57 return sdkPath; | 41 return sdkPath; |
| 58 } | 42 } |
| 59 } | 43 } |
| 60 return null; | 44 return null; |
| 61 } | 45 } |
| 62 static String setProperty(String name, String value) { | 46 static String setProperty(String name, String value) { |
| 63 String oldValue = _properties[name]; | 47 String oldValue = _properties[name]; |
| 64 _properties[name] = value; | 48 _properties[name] = value; |
| 65 return oldValue; | 49 return oldValue; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 var files = <JavaFile>[]; | 117 var files = <JavaFile>[]; |
| 134 var entities = _newDirectory().listSync(); | 118 var entities = _newDirectory().listSync(); |
| 135 for (FileSystemEntity entity in entities) { | 119 for (FileSystemEntity entity in entities) { |
| 136 files.add(new JavaFile(entity.path)); | 120 files.add(new JavaFile(entity.path)); |
| 137 } | 121 } |
| 138 return files; | 122 return files; |
| 139 } | 123 } |
| 140 File _newFile() => new File(_path); | 124 File _newFile() => new File(_path); |
| 141 Directory _newDirectory() => new Directory(_path); | 125 Directory _newDirectory() => new Directory(_path); |
| 142 } | 126 } |
| OLD | NEW |