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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/generator/chrome/build.dart

Issue 23054008: Remove the Path class from dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed first round of review comments Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer_experimental/lib/options.dart » ('j') | utils/compiler/create_snapshot.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/generator/chrome/build.dart
diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/generator/chrome/build.dart b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/generator/chrome/build.dart
index 4b0d2ef1a8721f294709a57c1f80944b31eeeeab..1bf048d5db6bf58d7ae36acc51f2a0ab8ce9607c 100644
--- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/generator/chrome/build.dart
+++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/generator/chrome/build.dart
@@ -14,36 +14,32 @@ void main() {
});
if (fullBuild || dartFilesChanged || args.isEmpty) {
- copyDirectory(directory('packages'), directory('app/packages'));
+ copyDirectory(new Uri.file('packages/'), new Uri.file('app/packages/'));
}
}
-Path directory(String path) => new Path(path);
+void copyDirectory(Uri src, Uri dest) {
+ Directory srcDir = new Directory(src.toFilePath());
-void copyDirectory(Path srcDirPath, Path destDirPath) {
- Directory srcDir = new Directory.fromPath(srcDirPath);
-
for (FileSystemEntity entity in srcDir.listSync()) {
- String name = new Path(entity.path).filename;
-
+ String name = new Uri.file(entity.path).pathSegments.last;
+
if (entity is File) {
- copyFile(srcDirPath.join(new Path(name)), destDirPath);
+ copyFile(src.resolve(name), dest);
} else {
- copyDirectory(
- srcDirPath.join(new Path(name)),
- destDirPath.join(new Path(name)));
+ copyDirectory(src.resolve("$name/"), dest.resolve("$name/"));
}
}
}
-void copyFile(Path srcFilePath, Path destDirPath) {
- File srcFile = new File.fromPath(srcFilePath);
- File destFile = new File.fromPath(
- destDirPath.join(new Path(srcFilePath.filename)));
-
- if (!destFile.existsSync() || srcFile.lastModifiedSync() != destFile.lastModifiedSync()) {
- new Directory.fromPath(destDirPath).createSync(recursive: true);
-
+void copyFile(Uri src, Uri dest) {
+ File srcFile = new File(src.toFilePath());
+ File destFile = new File(dest.resolve(src.pathSegments.last).toFilePath());
+
+ if (!destFile.existsSync() ||
+ srcFile.lastModifiedSync() != destFile.lastModifiedSync()) {
+ new Directory(dest.toFilePath()).createSync(recursive: true);
+
destFile.writeAsBytesSync(srcFile.readAsBytesSync());
}
}
« no previous file with comments | « no previous file | pkg/analyzer_experimental/lib/options.dart » ('j') | utils/compiler/create_snapshot.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698