mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 06:21:50 +00:00
fix zip archives paths and add zip files test
- create_zip from a subdirectory wrote entry names with a leading
'/', so the mounted archive looked empty
- memory_ostream did not support tellp(), so create_zip into a memory
device wrote invalid offsets (-1) to the archive
- ZipFileDevice added missing parent directories for the first entry
only
- ZipFileDevice::exists returned false for the archive root
- MemoryDevice::mkdirs recreated existing directories, dropping their
content (mkdir("a/b") cleared "a"); overwriting a file duplicated its
name in the directory listing
Added dev/tests/zip_files.lua: builds archives with file.create_zip
from memory device root, subdirectories and the real filesystem,
mounts them and checks reading, listing and read-only access.
memory_filesystem.lua got checks for the MemoryDevice issues.
Closes #544
This commit is contained in:
parent
1dd1af1a72
commit
fa5466f675
5 changed files with 170 additions and 3 deletions
|
|
@ -41,6 +41,17 @@ assert(entries[1] == "memtest:dir/subdir/a.txt")
|
|||
assert(entries[2] == "memtest:dir/subdir/b.txt")
|
||||
assert(entries[3] == "memtest:dir/subdir/other")
|
||||
|
||||
debug.log("create sibling directory")
|
||||
file.mkdir("memtest:dir/subdir/sibling")
|
||||
assert(file.isfile("memtest:dir/subdir/a.txt"))
|
||||
assert(file.isdir("memtest:dir/subdir/other"))
|
||||
asserts.equals(4, #file.list("memtest:dir/subdir"))
|
||||
|
||||
debug.log("overwrite file")
|
||||
file.write("memtest:dir/subdir/a.txt", "overwritten")
|
||||
asserts.equals("overwritten", file.read("memtest:dir/subdir/a.txt"))
|
||||
asserts.equals(4, #file.list("memtest:dir/subdir"))
|
||||
|
||||
debug.log("remove tree")
|
||||
file.remove_tree("memtest:dir")
|
||||
assert(not file.isdir("memtest:dir"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue