Date: prev next · Thread: first prev next last
2017 Archives by date, by thread · List index


Although it's a FAQ I cannot find an answer. I'm trying to create an extension with Basic. 
Everything works fine when I pack the stuff with "zip -r foo.oxt ." given that I'm in the right 
directory, otherwise the parent dirs are included. But ChDir() is not available anymore in Basic so 
I have to go the hard way. 

With com.sun.star.packages.Package the zip is always corrupt and cannot be read, even what 
PackageFormat is set to false. Any idea how to solve this?

Sub addToZip(oZipPackage, path$, file$)
  Dim xInputStream
  Dim sDestName As String
  Dim oZipPackageStream, oZipPackageFolder
 
  
xInputStream=createUNOService("com.sun.star.ucb.SimpleFileAccess").OpenFileRead(convertToURL(path$ 
& file$))
  oZipPackageStream=oZipPackage.createInstance()
  oZipPackageStream.setInputStream(xInputStream)
  oZipPackageFolder=oZipPackage.getByHierarchicalName("")
  oZipPackageFolder.insertByName(file$,oZipPackageStream)
  oZipPackage.commitChanges()
End Sub

...
    oZipPackage = createUnoService("com.sun.star.packages.Package")
    Dim aArg As New com.sun.star.beans.NamedValue
    aArg.Name = "PackageFormat"
    aArg.Value = True 'plain Zip format
    oZipPackage.initialize(Array(oFileDialog.Files(0),aArg))
    addToZip(oZipPackage,sTempPath,"/description.xml")
    addToZip(oZipPackage,sTempPath,"/config.xcu")
    addToZip(oZipPackage,sTempPath,"/META-INF/manifest.xml")
    addToZip(oZipPackage,sTempPath,"/palettes/" & sPaletteName & ".soc")

Full code is at http://pastebin.com/e1rt0rSM but for only 1 day. 

TIA,
Heiko
-- 
Dr. Heiko Tietze
UX Designer
Tel. +49 (0)179/1268509

Attachment: signature.asc
Description: OpenPGP digital signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.