x404.co.uk
https://x404.co.uk/forum/

Bundles as files
https://x404.co.uk/forum/viewtopic.php?f=4&t=25004
Page 1 of 1

Author:  paulzolo [ Sat Feb 06, 2016 10:56 pm ]
Post subject:  Bundles as files

I’m tinkering with an idea in LIveCode (well worth looking at). It builds cross platform applications, and right now I’m making headway into a Stereo Card creation application. It works nicely, but the fly in the ointment at the moment is saving data. I can save a file with all the data necessary to rebuild the document when it’s reloading (yay me!), but the problem is if I save the images used, the file size balloons in a scary way. Two images should, as PNGs, occupy 20MB between them. In the saved data file, the images are stored as base64 data (necessary, apparently), and the file balloons to 140mb! Yikes.

So, to save space, I could easily drop the images as separate files, and the rest of the data into a text file which would then occupy a few K. This would have to happen in a folder, and on a Mac, I can turn a folder into a bundle which appears as a file to the OS. However, I don’t know if I can do this in Windows. Can I? What’s the file structure if I need to and (importantly, as this is a cross platform thing - LiveCode will output Windows and Mac versions from one file - I’ll need to dump a hybrid so both OSes can read them).

The fudge which crossed my mind (and I don‘t like it ) is to
1 - Create a folder, and put all files needed in it
2 - Zip the folder up & rename the .zip file with an extension that the application can be associated to
3 - Delete the folder
4 - Reverse process to load

Any ideas? I’m open to suggestions.

Author:  jonbwfc [ Sat Feb 06, 2016 11:24 pm ]
Post subject:  Re: Bundles as files

Do you need the 'create the folder/delete the folder' parts? Can't you create the zip in RAM and then just write the data to disk using whatever metadata/extension you like?

Author:  big_D [ Sun Feb 07, 2016 12:22 pm ]
Post subject:  Re: Bundles as files

Given that PNGs are already compressed, zipping probably wouldn't help. Can you turn up the compression on the PNGs?

Author:  paulzolo [ Sun Feb 07, 2016 11:19 pm ]
Post subject:  Re: Bundles as files

The idea of using .zip as the file container was really to stop the user from moving stuff around and leaving files behind.

Anyway, the problem has been sidestepped. LiveCode allows you to create extra stacks on the fly, and save them as separate files, so I can throw all the data onto that temporary stack, save it, and reload later and pull the data back. The file size is a much more palatable 20mb - which is about right for the images I’m using.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/