file packer, design question

Started by
1 comment, last by Empirical 19 years, 6 months ago
hello, i am writing a simple file packer to be used in future projects so i can simplify content loading, and i just have a few design questions. for creating and saving a pack file (my program just creates a file that has a header showing each file name and size, and then all the bytes of each file are copied to the single packf file) so right now i have coded it so you add files to the pack and then when you save, it reads all the files into a single buffer then outputs the header and then the buffer and then clears the buffer. and for loading i dont know what i should do becasue i want it so the buffer does not exsist in memory unless i am saving or loading. but i also do not what to extract the files as soon as i load a pack, but i guess i have to do one or the other. so my question is ... should i (a) create a buffer when loading a pack. so when the user saves i create the files from the buffer or just clear the buffer if the user decides they do not want to extract the pack. or should i (b) save temp copies of the files contained in the pack as soon as the pack is loaded, and either move the files if extracted or delete them if not. so should i use memory or the hard disk for this? thanks for any suggestions in advance.
Advertisement
why not create the buffer when loading a file from the pack (e.g. a buffer of 64kb should be enough) and delete it after file loading

locate the files in your pack on the fly
If it was me, (For reading during the game) Id keep a copy of the File location table (or whatever you have) but keep the files on the disc. Then id simply load the individual files as needed (I might cache them but lets keep it simple for now eh ;) ).

This topic is closed to new replies.

Advertisement