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

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: Minor fixes 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
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..4886ccb0f6579be4241aa7efa736042326606713 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
@@ -1,5 +1,7 @@
import "dart:io";
+import "package:path/path.dart";
+
/**
* This build script watches for changes to any .dart files and copies the root
* packages directory to the app/packages directory. This works around an issue
@@ -14,36 +16,31 @@ void main() {
});
if (fullBuild || dartFilesChanged || args.isEmpty) {
- copyDirectory(directory('packages'), directory('app/packages'));
+ copyDirectory('packages', 'app/packages');
}
}
-Path directory(String path) => new Path(path);
+void copyDirectory(String srcDirPath, String destDirPath) {
+ Directory srcDir = new Directory(srcDirPath);
-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 = basename(entity.path);
+
if (entity is File) {
- copyFile(srcDirPath.join(new Path(name)), destDirPath);
+ copyFile(join(srcDirPath, name), destDirPath);
} else {
- copyDirectory(
- srcDirPath.join(new Path(name)),
- destDirPath.join(new Path(name)));
+ copyDirectory(join(srcDirPath, name), join(destDirPath, name));
}
}
}
-void copyFile(Path srcFilePath, Path destDirPath) {
- File srcFile = new File.fromPath(srcFilePath);
- File destFile = new File.fromPath(
- destDirPath.join(new Path(srcFilePath.filename)));
-
+void copyFile(String srcFilePath, String destDirPath) {
+ File srcFile = new File(srcFilePath);
+ File destFile = new File(join(destDirPath, basename(srcFilePath)));
+
if (!destFile.existsSync() || srcFile.lastModifiedSync() != destFile.lastModifiedSync()) {
- new Directory.fromPath(destDirPath).createSync(recursive: true);
-
+ new Directory(destDirPath).createSync(recursive: true);
+
destFile.writeAsBytesSync(srcFile.readAsBytesSync());
}
}
« no previous file with comments | « no previous file | pkg/analyzer_experimental/lib/options.dart » ('j') | samples/tests/samples/standalone/sample_extension_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698