Chromium Code Reviews| 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. |
|
Andrei Mouravski
2013/05/10 21:56:34
What about a no-clobber option for deploy? Or a dr
nweiz
2013/05/13 21:59:45
I don't think this would be useful. "deploy" is ef
|
| +void copyFiles(Iterable<String> files, String baseDir, String destination) { |
|
Andrei Mouravski
2013/05/10 21:56:34
Is there a reason why dart:io doesn't have this fu
nweiz
2013/05/13 21:59:45
I'm not really the person to ask that question, bu
|
| + 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(); |