hashProtected function
Implementation
Map<String, String> hashProtected(String projectRoot) {
final separator = Platform.pathSeparator;
var root = Directory(projectRoot).absolute.path;
while (root.endsWith(separator) && root.length > separator.length) {
root = root.substring(0, root.length - separator.length);
}
final prefix = '$root$separator';
final hashes = <String, String>{};
for (final entity in Directory(
root,
).listSync(recursive: true, followLinks: false)) {
if (entity is! File) continue;
final relative = entity.absolute.path
.substring(prefix.length)
.replaceAll(separator, '/');
if (!isCachePath(relative)) {
hashes[relative] = computeRawHash(entity.readAsBytesSync());
}
}
return hashes;
}