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

Unified Diff: editor/util/plugins/com.google.dart.java2dart/resources/java_io.dart

Issue 19262002: Fix for JavaFile.getCanonicalPath(), don't use Path. (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 | « no previous file | pkg/analyzer_experimental/lib/src/generated/java_io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/util/plugins/com.google.dart.java2dart/resources/java_io.dart
diff --git a/editor/util/plugins/com.google.dart.java2dart/resources/java_io.dart b/editor/util/plugins/com.google.dart.java2dart/resources/java_io.dart
index d186c47764e3ea535c04ebed30802f42a307b41b..d73f79e4115878af0a3209b2c478d07869a9ab37 100644
--- a/editor/util/plugins/com.google.dart.java2dart/resources/java_io.dart
+++ b/editor/util/plugins/com.google.dart.java2dart/resources/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,25 @@ class JavaSystemIO {
class JavaFile {
static final String separator = Platform.pathSeparator;
static final int separatorChar = Platform.pathSeparator.codeUnitAt(0);
- Path _path;
- JavaFile(String path) {
- this._path = new Path(path);
- }
+ String _path;
+ JavaFile(this._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);
+ 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 +87,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();
Brian Wilkerson 2013/07/15 18:38:42 While the comment for this method reads "Synchrono
JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath());
JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath());
bool exists() {
@@ -118,6 +118,6 @@ class JavaFile {
}
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 | « no previous file | pkg/analyzer_experimental/lib/src/generated/java_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698