← Back to team overview

ubuntu-phone team mailing list archive

Re: Using a zip file?

 

On Wednesday 05 February 2014 11:18:21 Jamie Strandboge wrote:
> On 02/05/2014 10:50 AM, Sam Bull wrote:
> > I want to include some data with my app. It is a zip file about 15MB in
> > size, uncompressed the files are about 40MB. So, it would be nice to
> > keep it as compressed file.
> > 
> > Can click packages extract a file and save it somewhere appropriate when
> > installing to the phone?
> 
> Yes, applications have write access to a number of areas that are app
> specific and based on XDG. 'Runtime environment' under the developer
> docs[1] has the information you need for where to put things.

I think what he meant is to have hooks in the click package to call the unzip 
command upon installation.

But actually this begs the question: Why do you want to package up your files 
into a .zip? click packages compress their data automatically. So while the 
files would be unpackaged in the source repository, the actual resulting click 
package should be smaller without you compressing them yourself.


> 
> > If not, is there an easy way to access the contents of a compressed file
> > in QML/Javascript?
> 
> This actually isn't 'if not'-- while you have the write access, pure QML
> applications don't have filesystem access without the help of a (C++)
> extension, and I don't think there is an extension for
> uncompressing/compressing files, so you might have to write one for your
> app. Perhaps someone from the SDK team can comment on any plans or existing
> extensions for this sort of thing.
> 
> [1]http://developer.ubuntu.com/publish/apps/security-policy-for-click-packag
> es/


If you really want to uncompress the file yourself, it should be quite easy to 
do on your own by wrapping this into a minimalistic c++ plugin:
http://www.qtforum.org/article/35737/zip-and-unzip.html


Follow ups

References