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()); |
} |
} |