[flutter_tools] check for permission issues when copying file (#63540)

This commit is contained in:
Jonah Williams
2020-08-21 11:11:04 -07:00
committed by GitHub
parent 39be8a40b5
commit ee12d7c3fc
8 changed files with 253 additions and 68 deletions

View File

@@ -389,3 +389,24 @@ class TestFlutterCommandRunner extends FlutterCommandRunner {
);
}
}
/// A file system that allows preconfiguring certain entities.
///
/// This is useful for inserting mocks/entities which throw errors or
/// have other behavior that is not easily configured through the
/// filesystem interface.
class ConfiguredFileSystem extends ForwardingFileSystem {
ConfiguredFileSystem(FileSystem delegate, {@required this.entities}) : super(delegate);
final Map<String, FileSystemEntity> entities;
@override
File file(dynamic path) {
return (entities[path] as File) ?? super.file(path);
}
@override
Directory directory(dynamic path) {
return (entities[path] as Directory) ?? super.directory(path);
}
}