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

Unified Diff: pkg/analyzer_experimental/lib/src/generated/java_io.dart

Issue 19266005: Use pathos.fromUri() to make it work on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « editor/util/plugins/com.google.dart.java2dart/resources/java_io.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_experimental/lib/src/generated/java_io.dart
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_io.dart b/pkg/analyzer_experimental/lib/src/generated/java_io.dart
index d186c47764e3ea535c04ebed30802f42a307b41b..41c2e24f3d71eec54d5c799551244e69d0ae24d2 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_io.dart
@@ -1,6 +1,7 @@
library java.io;
import "dart:io";
+import 'package:path/path.dart' as pathos;
class JavaSystemIO {
static Map<String, String> _properties = new Map();
@@ -33,14 +34,14 @@ class JavaSystemIO {
String sdkPath;
// may be "xcodebuild/ReleaseIA32/dart" with "dart-sdk" sibling
{
- sdkPath = new Path(exec).directoryPath.append("dart-sdk").toNativePath();
+ sdkPath = pathos.join(pathos.dirname(exec), "dart-sdk");
if (new Directory(sdkPath).existsSync()) {
_properties[name] = sdkPath;
return sdkPath;
}
}
// probably be "dart-sdk/bin/dart"
- sdkPath = new Path(exec).directoryPath.directoryPath.toString();
+ sdkPath = pathos.dirname(pathos.dirname(exec));
_properties[name] = sdkPath;
return sdkPath;
}
@@ -58,26 +59,27 @@ class JavaSystemIO {
class JavaFile {
static final String separator = Platform.pathSeparator;
static final int separatorChar = Platform.pathSeparator.codeUnitAt(0);
- Path _path;
+ String _path;
JavaFile(String path) {
- this._path = new Path(path);
+ _path = pathos.normalize(path);
}
JavaFile.relative(JavaFile base, String child) {
if (child.isEmpty) {
this._path = base._path;
} else {
- this._path = base._path.join(new Path(child));
+ this._path = pathos.join(base._path, child);
}
}
- JavaFile.fromUri(Uri uri) : this(uri.path);
+ JavaFile.fromUri(Uri uri) : this(pathos.fromUri(uri));
+ String toString() => _path.toString();
int get hashCode => _path.hashCode;
bool operator ==(other) {
- return other is JavaFile && other._path.toNativePath() == _path.toNativePath();
+ return other is JavaFile && other._path == _path;
}
- String getPath() => _path.toNativePath();
- String getName() => _path.filename;
+ String getPath() => _path;
+ String getName() => pathos.basename(_path);
String getParent() {
- var result = _path.directoryPath.toNativePath();
+ var result = pathos.dirname(_path);
// "." or "/" or "C:\"
if (result.length < 4) return null;
return result;
@@ -87,8 +89,8 @@ class JavaFile {
if (parent == null) return null;
return new JavaFile(parent);
}
- String getAbsolutePath() => _path.canonicalize().toNativePath();
- String getCanonicalPath() => _path.canonicalize().toNativePath();
+ String getAbsolutePath() => pathos.absolute(_path);
+ String getCanonicalPath() => _newFile().fullPathSync();
JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath());
JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath());
bool exists() {
@@ -103,7 +105,7 @@ class JavaFile {
bool isDirectory() {
return _newDirectory().existsSync();
}
- Uri toURI() => new Uri(path: _path.toString());
+ Uri toURI() => pathos.toUri(_path);
String readAsStringSync() => _newFile().readAsStringSync();
int lastModified() {
if (!_newFile().existsSync()) return 0;
@@ -111,13 +113,13 @@ class JavaFile {
}
List<JavaFile> listFiles() {
- List<JavaFile> files = [];
- List<FileSystemEntity> entities = _newDirectory().listSync();
+ var files = <JavaFile>[];
+ var entities = _newDirectory().listSync();
for (FileSystemEntity entity in entities) {
files.add(new JavaFile(entity.path));
}
return files;
}
- File _newFile() => new File.fromPath(_path);
- Directory _newDirectory() => new Directory.fromPath(_path);
+ File _newFile() => new File(_path);
+ Directory _newDirectory() => new Directory(_path);
}
« no previous file with comments | « editor/util/plugins/com.google.dart.java2dart/resources/java_io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698