Question about zip

Alessandro Diaferia alediaferia at gmail.com
Sun Nov 15 10:17:08 CET 2009


2009/11/15 Yuen Hoe Lim <yuenhoe86 at gmail.com>

> Hi all,
>
> So I've been doing some work with PlasMate's publisher widget, and was
> wondering what is the correct way to do a zip (afaik plasmoid packages
> are basically zipped archives right?). Right now I'm basically calling
> a 'zip -r', my code looks like this:
>
>    QStringList argv("zip");
>    argv.append("-r");
>    argv.append(targetFile.path());
>    argv.append(".");
>    KProcess p;
>    p.setProgram(argv);
>    p.setWorkingDirectory(toExport.path());
>    p.execute();
>
> Is this an acceptable approach? In particular does this have
> portability issues and such?
>
> Thanks :)
> --
> ----
> Jason "moofang" Lim Yuen Hoe
> http://yuenhoe.co.cc/
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>


Well, imho this is not the way to go.
There's no control for the actual existence of the zip executable and
probably you should have used KStandardDirs for the executable path.
Anyway I do not think we should go for executable when we have already a
consistent api for archives.
You should use the KZip/KArchive api:
http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKArchive.html. This
way we assure portability without checking any executable existence.

Cheers :)
-- 
Alessandro Diaferia
KDE Developer
KDE e.V. member
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20091115/8cfba24b/attachment.htm 


More information about the Plasma-devel mailing list