Restructure hot mode test so it runs interactively. (#12519)

* Restructure hot mode test so it runs interactively.

This allows to add a benchmark for hot reload after actual source code change.

* Add curly braces, refactory copyRecursive
This commit is contained in:
Alexander Aprelev
2017-10-13 20:06:35 -07:00
committed by GitHub
parent 0999fca99d
commit be1467e0cd
3 changed files with 110 additions and 33 deletions

View File

@@ -98,6 +98,21 @@ void copy(File sourceFile, Directory targetDirectory, {String name}) {
target.writeAsBytesSync(sourceFile.readAsBytesSync());
}
void recursiveCopy(Directory source, Directory target) {
if (!target.existsSync())
target.createSync();
for (FileSystemEntity entity in source.listSync(followLinks: false)) {
final String name = path.basename(entity.path);
if (entity is Directory)
recursiveCopy(entity, new Directory(path.join(target.path, name)));
else if (entity is File) {
final File dest = new File(path.join(target.path, name));
dest.writeAsBytesSync(entity.readAsBytesSync());
}
}
}
FileSystemEntity move(FileSystemEntity whatToMove,
{Directory to, String name}) {
return whatToMove