[Kde-games-devel] Create file archives with Qt/kdelibs

Andreas Pakulat apaku at gmx.de
Thu May 15 23:27:29 CEST 2008


On 15.05.08 21:53:01, Stefan Majewsky wrote:
> Hi,
> 
> in the recent talk about Nonogram on this list, there was some discussion 
> about which archive formats can be used. I think this topic is worth its own 
> thread. For those who have missed the discussion until now, I have compiled 
> the most interesting parts at the end of this mail.
> 
> At first, why is this topic so important for me? I'm currently working on 
> Palapeli, a jigsaw puzzle game (located in playground). By now, Palapeli is 
> able to save games in its appdata directory ("appdata" as in 
> KStandardDirs::locate). It would also be nice to have an import/export 
> function to pack one or multiple games into a file which can be shared (just 
> as an ordinary box of puzzle pieces; imagine for example Alice sending a 
> holiday photo to Bob as a jigsaw puzzle).
> 
> With the "one or multiple games" I come to the point of packaging. (Actually, 
> I would have come to it yet earlier because a game consists of two files 
> currently, the game state and the image.) The best immediate solution for me 
> would be some kind of class which takes a list of files and generates an 
> archive (and the other way around for importing of archives). The question 
> I'm asking is whether something like this is already available; Christian 
> Ehrlicher said that there is something similar in 

If we're talking about code, then there's KArchive and its subclasses in
kdelibs. You can read and write from/to tar.bz2, tar.gz, .zip and even
.ar in case you need that. Its all in kdelibs/kio, api docs are here:
http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKArchive.html

We're using that in kdevelop for unpacking our project templates from
the .tar.bz or .zip files (depending on the OS thats being used).

Andreas

-- 
Your reasoning is excellent -- it's only your basic assumptions that are wrong.


More information about the kde-games-devel mailing list