Recommendations for archive or disk image libraries?

8 posts / 0 new
Last post
jap
jap's picture
Offline
Last seen: 9 months 2 weeks ago
Joined: 2011-06-04 05:53
Recommendations for archive or disk image libraries?

Hello,

I have a program which reads and modifies data stored in a directory structure. The data itself is in text files. What I would like to do is to pack everything in a single file, i.e. hide the complex directory structure from the users. I was thinking of a zip archive or a disk image.

Can anyone recommend a static ANSI C/C++ library which would allow manipulating the content of an archive or disk image?

I found zlib, but it seems that it can't handle directory structures.

I'm aiming for a cross-platform application which could be run on Amiga, Mac OS X, and Windows.

Rigo
Rigo's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2011-01-24 21:55
Could you not restructure

Could you not restructure your program to use an XML file?

Your current directory heirarchy could be emulated with elements in xml, and it's easily cross platform with expat or other xml handler.

Simon

salass00
salass00's picture
Offline
Last seen: 6 months 2 weeks ago
Joined: 2011-02-03 11:27
@jap There is libzip that

@jap

There is libzip that you can use. The version currently on OS4Depot is 0.10.1 but I can update it to the latest (0.11.1) if you want.

http://os4depot.net/index.php?function=showfile&file=development/library/misc/libzip.lha

jap
jap's picture
Offline
Last seen: 9 months 2 weeks ago
Joined: 2011-06-04 05:53
@Rigo I would rather not.

@Rigo
I would rather not. It's important that a novice can create the data using a text editor and no XML knowledge is required.

@salass00
Thanks! This is exactly what I've been looking for.
I installed the library but ran into linking problems. I'm using Rigo's CodeBench and I've added libzip.a to linker objects. When I build my project, I get these errors:

  1. /SDK/local/newlib/lib/libzip.a(zip_filerange_crc.o): In function `_zip_filerange_crc':
  2. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_filerange_crc.c:51: undefined reference to `crc32'
  3. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_filerange_crc.c:65: undefined reference to `crc32'
  4. /SDK/local/newlib/lib/libzip.a(zip_source_crc.o): In function `crc_read':
  5. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_crc.c:88: undefined reference to `crc32'
  6. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_crc.c:124: undefined reference to `crc32'
  7. /SDK/local/newlib/lib/libzip.a(zip_source_deflate.o): In function `deflate_decompress':
  8. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_deflate.c:340: undefined reference to `inflateInit2_'
  9. /SDK/local/newlib/lib/libzip.a(zip_source_deflate.o): In function `decompress_read':
  10. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_deflate.c:195: undefined reference to `inflate'
  11. /SDK/local/newlib/lib/libzip.a(zip_source_deflate.o): In function `deflate_decompress':
  12. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_deflate.c:352: undefined reference to `inflateEnd'
  13. /SDK/local/newlib/lib/libzip.a(zip_source_deflate.o): In function `deflate_compress':
  14. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_deflate.c:267: undefined reference to `deflateInit2_'
  15. /SDK/local/newlib/lib/libzip.a(zip_source_deflate.o): In function `compress_read':
  16. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_deflate.c:120: undefined reference to `deflate'
  17. /SDK/local/newlib/lib/libzip.a(zip_source_deflate.o): In function `deflate_compress':
  18. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_deflate.c:281: undefined reference to `deflateEnd'
  19. /SDK/local/newlib/lib/libzip.a(zip_source_deflate.o): In function `compress_read':
  20. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_deflate.c:120: undefined reference to `deflate'
  21. /SDK/local/newlib/lib/libzip.a(zip_source_pkware.o): In function `zip_source_pkware':
  22. /home/salass00/Development/Projects/Libraries/libzip-0.10.1/lib/zip_source_pkware.c:84: undefined reference to `get_crc_table'
afxgroup
afxgroup's picture
Offline
Last seen: 5 months 2 weeks ago
Joined: 2011-02-03 15:26
add -lz after -lzip

add -lz after -lzip

trixie
trixie's picture
Offline
Last seen: 6 months 3 weeks ago
Joined: 2011-02-03 13:58
Re: Recommendations for archive or disk image libraries?

@jap
I've been using libzip to dip into EPUB e-book files (which are in fact ZIP-packed XML files), and the library is extremely easy to use.

@salass
An update to the library will be very welcome!

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

salass00
salass00's picture
Offline
Last seen: 6 months 2 weeks ago
Joined: 2011-02-03 11:27
libzip 0.11.1 is now in the

libzip 0.11.1 is now in the OS4Depot upload queue.

@jap

As afxgroup said you also need to link also with libz as this lib is used for compression/decompression.

jap
jap's picture
Offline
Last seen: 9 months 2 weeks ago
Joined: 2011-06-04 05:53
I can compile and link

I can compile and link without errors now. Thanks afxgroup and salass00!

Log in or register to post comments