2009/11/15 Yuen Hoe Lim <yuenho...@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@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
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to