Xbase++ Requires Chilkat v11.0.0+
Xbase++
Transition from Zip.AppendOneFileOrDir to Zip.AddFile
Provides instructions for replacing deprecated AppendOneFileOrDir method calls with AddFile.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oZip
LOCAL cLocalFilePath
LOCAL nSaveExtraPath
LOCAL oEntryObj
LOCAL oZe
LOCAL nIndex
nSuccess := 0
oZip := CreateObject("Chilkat.Zip")
// ...
// ...
cLocalFilePath := "c:/someDir/example.dat"
nSaveExtraPath := 0
// ------------------------------------------------------------------------
// The AppendOneFileOrDir method is deprecated:
oEntryObj := oZip:AppendOneFileOrDir(cLocalFilePath, nSaveExtraPath)
IF (oZip:LastMethodSuccess == 0)
? oZip:LastErrorText
oZip:destroy()
RETURN
ENDIF
// ...
// ...
oEntryObj:destroy()
// ------------------------------------------------------------------------
// Do the equivalent using AddFile.
// Instead of returning the zip entry object, we just return success/failure.
nSuccess := oZip:AddFile(cLocalFilePath, nSaveExtraPath)
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()