1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Merge pull request #268 from DevCharly/filename-in-checksum

fixes #267: include filenames in checksums
This commit is contained in:
Cedric Beust 2016-07-08 17:02:58 -07:00 committed by GitHub
commit 99c57a5865

View file

@ -24,7 +24,7 @@ public class Md5 {
* a checksum of the last modified timestamp.
*/
fun toMd5Directories(filesOrDirectories: List<File>,
toBytes: (File) -> ByteArray = { it.lastModified().toString().toByteArray() } ): String? {
toBytes: (File) -> ByteArray = { "${it.path} ${it.lastModified()} ${it.length()}".toByteArray() } ): String? {
if (filesOrDirectories.any { it.exists() }) {
MessageDigest.getInstance("MD5").let { md5 ->
var fileCount = 0