3.2 KiB
3.2 KiB
File Format
Note that any unused bytes/bits should be zeroed-out before being written.
Format Version 0
File extension is "*.simplearchive"
First 18 bytes of file will be:
SIMPLE_ARCHIVE_VER
Next 2 bytes is 16-bit unsigned integer "version" in big-endian. In this case, it will be zero.
Next 4 bytes are bit-flags.
- The first byte
- The first bit is set if de/compressor is set for this archive.
The remaining unused flags are reserved for future revisions and are currently ignored.
If the previous "de/compressor is set" flag is enabled, then the next section is added:
- 2 bytes is 16-bit unsigned integer "compressor cmd+args" in big-endian. This does not include the NULL at the end of the string.
- X bytes of "compressor cmd+args" (length defined by previous value). Is a NULL-terminated string.
- 2 bytes is 16-bit unsigned integer "decompressor cmd+args" in big-endian. This does not include the NULL at the end of the string.
- X bytes of "decompressor cmd+args" (length defined by previous value). Is a NULL-terminated string.
The next 4 bytes is 32-bit unsigned integer "file count" in big-endian which will indicate the number of files in this archive.
Following the file-count bytes, the following bytes are added for each file:
- 2 bytes is 16-bit unsigned integer "filename length" in big-endian. This does not include the NULL at the end of the string.
- X bytes of filename (length defined by previous value). Is a NULL-terminated string.
- 4 bytes bit-flags
- The first byte
- The first bit is set if the file is a symbolic link.
- The second bit is "user read permission".
- The third bit is "user write permission".
- The fourth bit is "user execute permission".
- The fifth bit is "group read permission".
- The sixth bit is "group write permission".
- The seventh bit is "group execute permission".
- The eighth bit is "other read permission".
- The second byte.
- The first bit is "other write permission".
- The second bit is "other execute permission".
- The third bit is UNSET if relative links are preferred, and is SET if absolute links are preferred.
- The third byte.
- Currently unused.
- The fourth byte.
- Currently unused.
- The first byte
- If this file is a symbolic link:
- 2 bytes is 16-bit unsigned integer "link target absolute path" in big-endian. This does not include the NULL at the end of the string.
- X bytes of link-target-absolute-path (length defined by previous value). Is a NULL-terminated string. If the previous "size" value is 0, then this entry does not exist and should be skipped.
- 2 bytes is 16-bit unsigned integer "link target relative path" in big-endian. This does not include the NULL at the end of the string.
- X bytes of link-target-relative-path (length defined by previous value). Is a NULL-terminated string. If the previous "size" value is 0, then this entry does not exist and should be skipped.
- If this file is NOT a symbolic link:
- 8 bytes 64-bit unsigned integer "size of filename in this archive file" in big-endian.
- X bytes file data (length defined by previous value).