toASCIIArtTree method
Generates a ASCIIArtTree
from this ReleaseBundle files.
Implementation
Future<ASCIIArtTree> toASCIIArtTree() async {
var files = await this.files;
var paths = files.map((f) => f.filePath).toList();
var asciiArtTree = ASCIIArtTree.fromStringPaths(paths);
var filesPaths = Map.fromEntries(files.map((f) => MapEntry(f.filePath, f)));
var filesLengths = <ReleaseFile, int>{};
for (var f in files) {
filesLengths[f] = await f.length;
}
asciiArtTree.pathInfoProvider = (parents, node, path) {
var fullPath = [...parents, path].join('/');
var file = filesPaths[fullPath];
if (file == null) return null;
var execStr = file.executable ? ' (EXEC)' : '';
var fileLength = filesLengths[file];
var info = '- ($fileLength bytes)$execStr';
return info;
};
return asciiArtTree;
}