Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/java_io.dart

Issue 45573002: Rename analyzer_experimental to analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks before publishing. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 library java.io;
2
3 import "dart:io";
4 import 'java_core.dart' show JavaIOException;
5 import 'package:path/path.dart' as pathos;
6
7 class JavaSystemIO {
8 static Map<String, String> _properties = new Map();
9 static String getProperty(String name) {
10 {
11 String value = _properties[name];
12 if (value != null) {
13 return value;
14 }
15 }
16 if (name == 'os.name') {
17 return Platform.operatingSystem;
18 }
19 if (name == 'line.separator') {
20 if (Platform.isWindows) {
21 return '\r\n';
22 }
23 return '\n';
24 }
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;
34 if (exec.length != 0) {
35 String sdkPath;
36 // may be "xcodebuild/ReleaseIA32/dart" with "dart-sdk" sibling
37 {
38 sdkPath = pathos.join(pathos.dirname(exec), "dart-sdk");
39 if (new Directory(sdkPath).existsSync()) {
40 _properties[name] = sdkPath;
41 return sdkPath;
42 }
43 }
44 // probably be "dart-sdk/bin/dart"
45 sdkPath = pathos.dirname(pathos.dirname(exec));
46 _properties[name] = sdkPath;
47 return sdkPath;
48 }
49 }
50 return null;
51 }
52 static String setProperty(String name, String value) {
53 String oldValue = _properties[name];
54 _properties[name] = value;
55 return oldValue;
56 }
57 static String getenv(String name) => Platform.environment[name];
58 }
59
60 class JavaFile {
61 static final String separator = Platform.pathSeparator;
62 static final int separatorChar = Platform.pathSeparator.codeUnitAt(0);
63 String _path;
64 JavaFile(String path) {
65 _path = pathos.normalize(path);
66 }
67 JavaFile.relative(JavaFile base, String child) {
68 if (child.isEmpty) {
69 this._path = base._path;
70 } else {
71 this._path = pathos.join(base._path, child);
72 }
73 }
74 JavaFile.fromUri(Uri uri) : this(pathos.fromUri(uri));
75 String toString() => _path.toString();
76 int get hashCode => _path.hashCode;
77 bool operator ==(other) {
78 return other is JavaFile && other._path == _path;
79 }
80 String getPath() => _path;
81 String getName() => pathos.basename(_path);
82 String getParent() {
83 var result = pathos.dirname(_path);
84 // "." or "/" or "C:\"
85 if (result.length < 4) return null;
86 return result;
87 }
88 JavaFile getParentFile() {
89 var parent = getParent();
90 if (parent == null) return null;
91 return new JavaFile(parent);
92 }
93 String getAbsolutePath() => pathos.absolute(_path);
94 String getCanonicalPath() {
95 try {
96 return _newFile().fullPathSync();
97 } catch (e) {
98 throw new JavaIOException('IOException', e);
99 }
100 }
101 JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath());
102 JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath());
103 bool exists() {
104 if (_newFile().existsSync()) {
105 return true;
106 }
107 if (_newDirectory().existsSync()) {
108 return true;
109 }
110 return false;
111 }
112 bool isDirectory() {
113 return _newDirectory().existsSync();
114 }
115 Uri toURI() => pathos.toUri(_path);
116 String readAsStringSync() => _newFile().readAsStringSync();
117 int lastModified() {
118 if (!_newFile().existsSync()) return 0;
119 return _newFile().lastModifiedSync().millisecondsSinceEpoch;
120
121 }
122 List<JavaFile> listFiles() {
123 var files = <JavaFile>[];
124 var entities = _newDirectory().listSync();
125 for (FileSystemEntity entity in entities) {
126 files.add(new JavaFile(entity.path));
127 }
128 return files;
129 }
130 File _newFile() => new File(_path);
131 Directory _newDirectory() => new Directory(_path);
132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698