Create root directory in tar/zip files

Signed-off-by: Graham <gpe@openrs2.org>
Graham 3 years ago
parent 3848a89f68
commit da131000ba
  1. 3
      cache/src/main/kotlin/org/openrs2/cache/DiskStoreZipWriter.kt
  2. 5
      cache/src/main/kotlin/org/openrs2/cache/FlatFileStoreTarWriter.kt
  3. BIN
      cache/src/test/resources/org/openrs2/cache/disk-store-zip/cache.zip
  4. BIN
      cache/src/test/resources/org/openrs2/cache/flat-file-store-tar/cache.tar

@ -42,6 +42,9 @@ public class DiskStoreZipWriter(
init { init {
out.setLevel(level) out.setLevel(level)
out.putNextEntry(createZipEntry(""))
out.putNextEntry(createZipEntry("main_file_cache.dat2")) out.putNextEntry(createZipEntry("main_file_cache.dat2"))
out.write(zeroBlock) out.write(zeroBlock)
} }

@ -24,6 +24,11 @@ public class FlatFileStoreTarWriter(
) : Store { ) : Store {
private val timestamp = Date.from(timestamp) private val timestamp = Date.from(timestamp)
init {
out.putArchiveEntry(createTarEntry("", size = 0))
out.closeArchiveEntry()
}
private fun createTarEntry(name: String, size: Int): TarArchiveEntry { private fun createTarEntry(name: String, size: Int): TarArchiveEntry {
val entry = TarArchiveEntry(prefix + name) val entry = TarArchiveEntry(prefix + name)
entry.modTime = timestamp entry.modTime = timestamp

Loading…
Cancel
Save