Tcl
Tcl
Transition from ZipEntry.NextEntry to ZipEntry.GetNext
Provides instructions for replacing deprecated NextEntry method calls with GetNext.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# ------------------------------------------------------------------------
# The NextEntry method is deprecated.
# See below or code showing how to rewrite using EntryAt/GetNext
set zip [new_CkZip]
set success [CkZip_OpenZip $zip "qa_data/zips/xml_files.zip"]
if {$success != 1} then {
puts [CkZip_lastErrorText $zip]
delete_CkZip $zip
exit
}
# entry is a CkZipEntry
set entry [CkZip_FirstEntry $zip]
if {[CkZip_get_LastMethodSuccess $zip] == 0} then {
puts "This zip archive is empty."
delete_CkZip $zip
exit
}
set finished 0
while {$finished == 0} {
if {[CkZipEntry_get_IsDirectory $entry] == 0} then {
puts [CkZipEntry_fileName $entry]
} else {
puts "(directory) [CkZipEntry_fileName $entry]"
}
# next is a CkZipEntry
set next [CkZipEntry_NextEntry $entry]
if {[CkZipEntry_get_LastMethodSuccess $entry] == 0} then {
set finished 1
}
delete_CkZipEntry $entry
set entry $next
}
CkZip_CloseZip $zip
puts "----"
# ------------------------------------------------------------------------
# Do the equivalent using EntryAt/GetNext.
set success [CkZip_OpenZip $zip "qa_data/zips/xml_files.zip"]
set ze [new_CkZipEntry]
CkZip_EntryAt $zip 0 $ze
set entryValid 1
while {$entryValid == 1} {
if {[CkZipEntry_get_IsDirectory $ze] == 0} then {
puts [CkZipEntry_fileName $ze]
} else {
puts "(directory) [CkZipEntry_fileName $ze]"
}
set entryValid [CkZipEntry_GetNext $ze]
}
CkZip_CloseZip $zip
delete_CkZip $zip
delete_CkZipEntry $ze