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

Unified Diff: sdk/lib/_internal/pub/lib/src/io.dart

Issue 14914007: Add a "pub deploy" command. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 7 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: sdk/lib/_internal/pub/lib/src/io.dart
diff --git a/sdk/lib/_internal/pub/lib/src/io.dart b/sdk/lib/_internal/pub/lib/src/io.dart
index 46e525509ca126309868b25d1211082c0c547eed..da220e4a537f40fc1a7264f87ad3f9e2cee8234e 100644
--- a/sdk/lib/_internal/pub/lib/src/io.dart
+++ b/sdk/lib/_internal/pub/lib/src/io.dart
@@ -185,6 +185,22 @@ Future<String> createFileFromStream(Stream<List<int>> stream, String file) {
});
}
+/// Copy all files in [files] to the directory [destination]. Their locations in
+/// [destination] will be determined by their relative location to [baseDir].
+/// Any existing files at those paths will be overwritten.
+void copyFiles(Iterable<String> files, String baseDir, String destination) {
+ for (var file in files) {
+ var newPath = path.join(destination, path.relative(file, from: baseDir));
+ ensureDir(path.dirname(newPath));
+ copyFile(file, newPath);
+ }
+}
+
+/// Copy a file from [source] to [destination].
+void copyFile(String source, String destination) {
+ writeBinaryFile(destination, readBinaryFile(source));
+}
+
/// Creates a directory [dir].
String createDir(String dir) {
new Directory(dir).createSync();

Powered by Google App Engine
This is Rietveld 408576698