Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

Transition from Zip.AppendNewDir to Zip.AddEmpty

Provides instructions for replacing deprecated AppendNewDir method calls with AddEmpty.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oZip
LOCAL cPathInZip
LOCAL oEntryObj
LOCAL nIsDir
LOCAL oZe
LOCAL nIndex

nSuccess := 0

oZip := CreateObject("Chilkat.Zip")

//  ...
//  ...
cPathInZip := "exampleDir"

//  ------------------------------------------------------------------------
//  The AppendNewDir method is deprecated:

oEntryObj := oZip:AppendNewDir(cPathInZip)
IF (oZip:LastMethodSuccess == 0)
    ? oZip:LastErrorText
    oZip:destroy()
    RETURN
ENDIF

//  ...
//  ...

oEntryObj:destroy()

//  ------------------------------------------------------------------------
//  Do the equivalent using AddEmpty.

//  Indicate the newly appended entry is a directory entry.
nIsDir := 1

//  Instead of returning the zip entry object, we just return success/failure.
nSuccess := oZip:AddEmpty(nIsDir, cPathInZip)
IF (nSuccess == 0)
    ? oZip:LastErrorText
    oZip:destroy()
    RETURN
ENDIF

//  Do the following if you need the zip entry object for what was just appended.
//  The newly appended entry is the last one.
oZe := CreateObject("Chilkat.ZipEntry")
nIndex := oZip:NumEntries - 1
oZip:EntryAt(nIndex, oZe)

oZip:destroy()
oZe:destroy()