Skip to content

Commit

Permalink
Fix reproducable archives
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 10, 2024
1 parent ebf4711 commit ffaaf23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/generate_leap/lib/src/archive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Future<Archive> createReproducableArchive(
return a.path.compareTo(b.path);
}
});
await Future.wait(files.map((file) async {
for (final file in files) {
if (file is File) {
final filename = file.path.substring(dir.path.length + 1);
final fileData = await file.readAsBytes();
Expand All @@ -29,7 +29,7 @@ Future<Archive> createReproducableArchive(
await addDirectory(
file, '$prefix/${file.path.substring(dir.path.length + 1)}');
}
}));
}
}

await addDirectory(dir, '');
Expand Down
3 changes: 2 additions & 1 deletion packages/lw_file_system/lib/src/api/file_system_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,15 @@ abstract class GeneralFileSystem {
Future.value(false);
}

Archive exportDirectory(FileSystemDirectory directory) {
Archive exportDirectory(FileSystemDirectory directory, {int? lastModTime}) {
final archive = Archive();
void addToArchive(FileSystemEntity asset) {
if (asset is FileSystemFile) {
final data = asset.data;
if (data == null) return;
final size = data.length;
final file = ArchiveFile(asset.path, size, data);
if (lastModTime != null) file.lastModTime = lastModTime;
archive.addFile(file);
} else if (asset is FileSystemDirectory) {
var assets = asset.assets;
Expand Down

0 comments on commit ffaaf23

Please sign in to comment.