Skip to content

Commit a50e3fb

Browse files
authored
Directory entries may appear in random order (flutter#5936)
1 parent 04e2e0f commit a50e3fb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tool/plugin/lib/artifact.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ class ArtifactManager {
142142
var files = Directory(artifact.outPath).listSync();
143143
if (files.length < 3) /* Might have .DS_Store */ {
144144
// This is the Mac zip case.
145-
Directory("${files.first.path}/Contents")
145+
var entity = files.first;
146+
if (entity.statSync().type == FileSystemEntityType.file) {
147+
entity = files.last;
148+
}
149+
Directory("${entity.path}/Contents")
146150
.renameSync("${artifact.outPath}Temp");
147151
Directory(artifact.outPath).deleteSync(recursive: true);
148152
Directory("${artifact.outPath}Temp").renameSync(artifact.outPath);

0 commit comments

Comments
 (0)