From da131000bac6d25aad295e533a8d99c92b6272ed Mon Sep 17 00:00:00 2001 From: Graham Date: Wed, 1 Sep 2021 12:08:52 +0100 Subject: [PATCH] Create root directory in tar/zip files Signed-off-by: Graham --- .../org/openrs2/cache/DiskStoreZipWriter.kt | 3 +++ .../openrs2/cache/FlatFileStoreTarWriter.kt | 5 +++++ .../openrs2/cache/disk-store-zip/cache.zip | Bin 1008 -> 1140 bytes .../cache/flat-file-store-tar/cache.tar | Bin 5632 -> 6144 bytes 4 files changed, 8 insertions(+) diff --git a/cache/src/main/kotlin/org/openrs2/cache/DiskStoreZipWriter.kt b/cache/src/main/kotlin/org/openrs2/cache/DiskStoreZipWriter.kt index 9f19aae57c..47cb596131 100644 --- a/cache/src/main/kotlin/org/openrs2/cache/DiskStoreZipWriter.kt +++ b/cache/src/main/kotlin/org/openrs2/cache/DiskStoreZipWriter.kt @@ -42,6 +42,9 @@ public class DiskStoreZipWriter( init { out.setLevel(level) + + out.putNextEntry(createZipEntry("")) + out.putNextEntry(createZipEntry("main_file_cache.dat2")) out.write(zeroBlock) } diff --git a/cache/src/main/kotlin/org/openrs2/cache/FlatFileStoreTarWriter.kt b/cache/src/main/kotlin/org/openrs2/cache/FlatFileStoreTarWriter.kt index 3431ac1613..9f4246e8ee 100644 --- a/cache/src/main/kotlin/org/openrs2/cache/FlatFileStoreTarWriter.kt +++ b/cache/src/main/kotlin/org/openrs2/cache/FlatFileStoreTarWriter.kt @@ -24,6 +24,11 @@ public class FlatFileStoreTarWriter( ) : Store { private val timestamp = Date.from(timestamp) + init { + out.putArchiveEntry(createTarEntry("", size = 0)) + out.closeArchiveEntry() + } + private fun createTarEntry(name: String, size: Int): TarArchiveEntry { val entry = TarArchiveEntry(prefix + name) entry.modTime = timestamp diff --git a/cache/src/test/resources/org/openrs2/cache/disk-store-zip/cache.zip b/cache/src/test/resources/org/openrs2/cache/disk-store-zip/cache.zip index 1eb38c58bd15b074d80e46d061ea3bfe53eadca1..c3eb90dee746f0169a14da494abb28d615c70054 100644 GIT binary patch delta 123 zcmeys{)JNCx2&>Vs>X> ym@L33K3SXDocTVOEj78G*@W4O5hN}v%gVqG(jVZ>$_AoYfY5-EfkBTM!~+0<)fH<1 delta 64 zcmeyu@qvAU)Wn}slh-q|ZEW1jG`X5tijiURH0A*284L^)|Hw{eV=-j@3}Q-64q*}E QV`gAx0CE|gGXV((0NO(m!vFvP diff --git a/cache/src/test/resources/org/openrs2/cache/flat-file-store-tar/cache.tar b/cache/src/test/resources/org/openrs2/cache/flat-file-store-tar/cache.tar index f972b2b5350bb8f062e51cc3a862f045c70f6844..a16ba38d13d27b40c2b2efa007281fef9cbbb961 100644 GIT binary patch delta 37 tcmZqBX)s_*PE5{7)t|U9Zeofto0*{rgM#VgM8=fOjEt;|8`*w|0s!5H3l0DP delta 7 OcmZoLXwX^2BnAKp*8&#+