- xmlTextWriterEndElement (x->manifest_wtr);
- xmlTextWriterEndDocument (x->manifest_wtr);
- xmlFreeTextWriter (x->manifest_wtr);
-
- return true;
-}
-
-static bool
-odt_close_driver (struct outp_driver *this)
-{
- struct string zip_cmd;
- struct string rm_cmd;
- struct odt_driver_ext *x = this->ext;
-
- xmlTextWriterEndElement (x->content_wtr); /* office:text */
- xmlTextWriterEndElement (x->content_wtr); /* office:body */
- xmlTextWriterEndElement (x->content_wtr); /* office:document-content */
-
- xmlTextWriterEndDocument (x->content_wtr);
- xmlFreeTextWriter (x->content_wtr);
-
- /* Zip up the directory */
- ds_init_empty (&zip_cmd);
- ds_put_format (&zip_cmd, "cd %s ; rm -f ../pspp.odt; zip -q -X ../pspp.odt mimetype; zip -q -X -u -r ../pspp.odt .", x->dirname);
- system (ds_cstr (&zip_cmd));
- ds_destroy (&zip_cmd);
-
-
- /* Remove the temp dir */
- ds_init_empty (&rm_cmd);
- ds_put_format (&rm_cmd, "rm -r %s", x->dirname);
- system (ds_cstr (&rm_cmd));
- ds_destroy (&rm_cmd);
-
- free (x->dirname);
- free (x);
+ xmlTextWriterEndElement (odt->manifest_wtr);
+ xmlTextWriterEndDocument (odt->manifest_wtr);
+ xmlFreeTextWriter (odt->manifest_wtr);
+ zip_writer_add (odt->zip, odt->manifest_file, "META-INF/manifest.xml");
+ close_temp_file (odt->manifest_file);