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

Side by Side Diff: packages/analyzer/lib/src/generated/java_io.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 months 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
OLDNEW
1 library java.io; 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library analyzer.src.generated.java_io;
2 6
3 import "dart:io"; 7 import "dart:io";
4 8
5 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
6 10
7 import 'java_core.dart' show JavaIOException;
8
9 class JavaFile { 11 class JavaFile {
12 @deprecated
10 static path.Context pathContext = path.context; 13 static path.Context pathContext = path.context;
11 static final String separator = Platform.pathSeparator; 14 static final String separator = Platform.pathSeparator;
12 static final int separatorChar = Platform.pathSeparator.codeUnitAt(0); 15 static final int separatorChar = Platform.pathSeparator.codeUnitAt(0);
13 String _path; 16 String _path;
14 JavaFile(String path) { 17 JavaFile(String path) {
15 _path = path; 18 _path = path;
16 } 19 }
17 JavaFile.fromUri(Uri uri) : this(pathContext.fromUri(uri)); 20 JavaFile.fromUri(Uri uri) : this(path.context.fromUri(uri));
18 JavaFile.relative(JavaFile base, String child) { 21 JavaFile.relative(JavaFile base, String child) {
19 if (child.isEmpty) { 22 if (child.isEmpty) {
20 this._path = base._path; 23 this._path = base._path;
21 } else { 24 } else {
22 this._path = pathContext.join(base._path, child); 25 this._path = path.context.join(base._path, child);
23 } 26 }
24 } 27 }
28 @override
25 int get hashCode => _path.hashCode; 29 int get hashCode => _path.hashCode;
30 @override
26 bool operator ==(other) { 31 bool operator ==(other) {
27 return other is JavaFile && other._path == _path; 32 return other is JavaFile && other._path == _path;
28 } 33 }
29 34
30 bool exists() { 35 bool exists() {
31 if (_newFile().existsSync()) { 36 if (_newFile().existsSync()) {
32 return true; 37 return true;
33 } 38 }
34 if (_newDirectory().existsSync()) { 39 if (_newDirectory().existsSync()) {
35 return true; 40 return true;
36 } 41 }
37 return false; 42 return false;
38 } 43 }
39 44
40 JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath()); 45 JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath());
41 String getAbsolutePath() { 46 String getAbsolutePath() {
42 String path = pathContext.absolute(_path); 47 String abolutePath = path.context.absolute(_path);
43 path = pathContext.normalize(path); 48 abolutePath = path.context.normalize(abolutePath);
44 return path; 49 return abolutePath;
45 } 50 }
46 51
47 JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath()); 52 JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath());
48 String getCanonicalPath() { 53 String getCanonicalPath() {
49 try { 54 return _newFile().resolveSymbolicLinksSync();
50 return _newFile().resolveSymbolicLinksSync();
51 } catch (e) {
52 throw new JavaIOException('IOException', e);
53 }
54 } 55 }
55 56
56 String getName() => pathContext.basename(_path); 57 String getName() => path.context.basename(_path);
57 String getParent() { 58 String getParent() {
58 var result = pathContext.dirname(_path); 59 var result = path.context.dirname(_path);
59 // "." or "/" or "C:\" 60 // "." or "/" or "C:\"
60 if (result.length < 4) return null; 61 if (result.length < 4) return null;
61 return result; 62 return result;
62 } 63 }
63 64
64 JavaFile getParentFile() { 65 JavaFile getParentFile() {
65 var parent = getParent(); 66 var parent = getParent();
66 if (parent == null) return null; 67 if (parent == null) return null;
67 return new JavaFile(parent); 68 return new JavaFile(parent);
68 } 69 }
(...skipping 22 matching lines...) Expand all
91 List<JavaFile> listFiles() { 92 List<JavaFile> listFiles() {
92 var files = <JavaFile>[]; 93 var files = <JavaFile>[];
93 var entities = _newDirectory().listSync(); 94 var entities = _newDirectory().listSync();
94 for (FileSystemEntity entity in entities) { 95 for (FileSystemEntity entity in entities) {
95 files.add(new JavaFile(entity.path)); 96 files.add(new JavaFile(entity.path));
96 } 97 }
97 return files; 98 return files;
98 } 99 }
99 100
100 String readAsStringSync() => _newFile().readAsStringSync(); 101 String readAsStringSync() => _newFile().readAsStringSync();
102 @override
101 String toString() => _path.toString(); 103 String toString() => _path.toString();
102 Uri toURI() { 104 Uri toURI() {
103 String path = getAbsolutePath(); 105 String absolutePath = getAbsolutePath();
104 return pathContext.toUri(path); 106 return path.context.toUri(absolutePath);
105 } 107 }
106 108
107 Directory _newDirectory() => new Directory(_path); 109 Directory _newDirectory() => new Directory(_path);
108 File _newFile() => new File(_path); 110 File _newFile() => new File(_path);
109 } 111 }
110 112
111 class JavaSystemIO { 113 class JavaSystemIO {
112 static Map<String, String> _properties = new Map(); 114 static Map<String, String> _properties = new Map();
113 static String getenv(String name) => Platform.environment[name]; 115 static String getenv(String name) => Platform.environment[name];
114 static String getProperty(String name) { 116 static String getProperty(String name) {
(...skipping 11 matching lines...) Expand all
126 return '\r\n'; 128 return '\r\n';
127 } 129 }
128 return '\n'; 130 return '\n';
129 } 131 }
130 if (name == 'com.google.dart.sdk') { 132 if (name == 'com.google.dart.sdk') {
131 String exec = Platform.executable; 133 String exec = Platform.executable;
132 if (exec.length != 0) { 134 if (exec.length != 0) {
133 String sdkPath; 135 String sdkPath;
134 // may be "xcodebuild/ReleaseIA32/dart" with "sdk" sibling 136 // may be "xcodebuild/ReleaseIA32/dart" with "sdk" sibling
135 { 137 {
136 var outDir = 138 var outDir = path.context.dirname(path.context.dirname(exec));
137 JavaFile.pathContext.dirname(JavaFile.pathContext.dirname(exec)); 139 sdkPath = path.context.join(path.context.dirname(outDir), "sdk");
138 sdkPath = JavaFile.pathContext
139 .join(JavaFile.pathContext.dirname(outDir), "sdk");
140 if (new Directory(sdkPath).existsSync()) { 140 if (new Directory(sdkPath).existsSync()) {
141 _properties[name] = sdkPath; 141 _properties[name] = sdkPath;
142 return sdkPath; 142 return sdkPath;
143 } 143 }
144 } 144 }
145 // probably be "dart-sdk/bin/dart" 145 // probably be "dart-sdk/bin/dart"
146 sdkPath = 146 sdkPath = path.context.dirname(path.context.dirname(exec));
147 JavaFile.pathContext.dirname(JavaFile.pathContext.dirname(exec));
148 _properties[name] = sdkPath; 147 _properties[name] = sdkPath;
149 return sdkPath; 148 return sdkPath;
150 } 149 }
151 } 150 }
152 return null; 151 return null;
153 } 152 }
154 153
155 static String setProperty(String name, String value) { 154 static String setProperty(String name, String value) {
156 String oldValue = _properties[name]; 155 String oldValue = _properties[name];
157 _properties[name] = value; 156 _properties[name] = value;
158 return oldValue; 157 return oldValue;
159 } 158 }
160 } 159 }
OLDNEW
« no previous file with comments | « packages/analyzer/lib/src/generated/java_engine_io.dart ('k') | packages/analyzer/lib/src/generated/package.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698