!!! This is a WIP stuff, not finished yet!!!!
(but more or less working)
This patches add archive handling capability to libspectrum and of course to Fuse.
There are two patch:
1. libspectrum patch
- libspectrum.h.in: a new class: LIBSPECTRUM_CLASS_ARCHIVE, and some new id: LIBSPECTRUM_ID_COMPRESSED_ZIP, ...ARCHIVE_ZIP, ...ARCHIVE_TAR and ...ARCHIVE_CPIO
- the declaration of libspectrum_uncompress_file (Fuse need it)
- zlib.c: `skip_pkzip_header' and `libspectrum_pkzip_inflate' functions for handling zip archives
- libspectrum.c: some new type in `libspectrum_identify_file_raw' for zip, tar, and cpio files;
- some new code in `...identify_class' for archives
- new code in `...uncompress_file' to uncompress zip archive members
- a new static function `read_ascii_number' to read ascii octal and hexa numbers from tar and cpio headers
- new function `...extract_member' to extract a given or the first member of an archive
- internals.h: new decl. for `...pkzip_inflate'
2. fuse patch
- utils.h: two new mwmber in file struct: file type and file class
- fuse.c: removed an `...identify...' because the `file' structure include the opened file class and type
- utils.c: utils_open_file see above :)
- utils_read_file: some new code, to handle the automatic decompression and dearchiving of files
If we try to open an archive or a compressed file \(through utils\_read\_file or utils\_open\_file\), fuse uncompress it or extract the first or given member of the archive. If the new 'file' is an archive or a compressed file, \`utils\_read\_file' unarchive/uncompress it , and so on... So, we can open tar.gz, or cpio.gz files... \(or zip files :\) e.g.: fuse demo.tar.gz -> \`utils\_read\_file' read it -> and uncompress -> the new 'file' name is demo.tar -> now extract the first \(regular file\) member \`e.g. demo.mdr' from it we can point a member of an archive: e.g.: fuse Demo/demo.tar.gz/demos/Tube128K.csw now \`utils\_read\_file' cannot open this file, so try to locate the first 'real' file-> Demo/demo.tar.gz now open this file and uncompress it \(demo.tar\) and then try to extract the \`demos/Tube128K.csw' member from it ~~~~~~~~~~~~~~~ what works -- what not 0\. general: If we have recursive archives \(e.g. a zip file in a zip file\). We cannot point to a member in the inner archive\(s\). e.g. \`a.zip/b.zip/demo.mdr' does not work, only \`a.zip/b.zip'. Of course cannot write to an archive or compressed file ;\) 1\. Zip: Libspectrum uses the local file headers, not the central directory, so not all zip files works \(e.g. created from standard in, or created to stdout\) does not handles \(and cannot identify\) encryption and other compressing methods only than \`store' and \`deflate'. There is a 'hack' in the \(libspectrum\) code in order to \`...identify\_file\_raw' correctly distinguish between a zip archive, and a compressed zip member: the \`...extract\_member' overwrites the 'version need to extract' field with \`MB' in the extracted file local header, so \`...identify...' can identify it as a pkzip compressed 'file'. Cannot identify the file types \(regular/directory, etc\), so if the first member is e.g. a directory and we does not give a member, fuse fails to open... 2\. tar: Libspectrum handles only the old v7 and the GNU ustar format. Cannot handle filenames more than 100 character length \(the ustar's \`prefix' field\) 3\. cpio Libspectrum handles the old binary \(bin\), the old ascii \(odc\), the new ascii \(newc\) and the new crc formats. The old binary format fail if an archive \`cross' the endiannes margin :\(
We need an `Archive Browser' widget in order to users can pick up a member easily from an archive.
imho: the `open file' widget(s) have to allow to users can type file names (like in save dialog) not just select...
Log in to post a comment.