Create an empty zip file in ZipToolBuilder if the entry list is empty (#5311)

This can happen if you build an FLX in release mode for an app with no assets
(such as the hello_world example)
This commit is contained in:
Jason Simmons 2016-08-09 15:50:17 -07:00 committed by GitHub
parent 6b3766d661
commit 8d5c2540ea

View File

@ -50,6 +50,13 @@ class _ZipToolBuilder extends ZipBuilder {
@override
void createZip(File outFile, Directory zipBuildDir) {
// If there are no assets, then create an empty zip file.
if (entries.isEmpty) {
List<int> zipData = new ZipEncoder().encode(new Archive());
outFile.writeAsBytesSync(zipData);
return;
}
if (outFile.existsSync())
outFile.deleteSync();