(Tcl) Transition from SFtp.ReadDir to SFtp.ReadDirListing
Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing. Note: This example requires Chilkat v11.0.0 or greater.
load ./chilkat.dll
set success 0
set sftp [new_CkSFtp]
# ...
# ...
set handle [CkSFtp_openDir $sftp "."]
# ...
# ...
# ------------------------------------------------------------------------
# The ReadDir method is deprecated:
# dirObj is a CkSFtpDir
set dirObj [CkSFtp_ReadDir $sftp $handle]
if {[CkSFtp_get_LastMethodSuccess $sftp] == 0} then {
puts [CkSFtp_lastErrorText $sftp]
delete_CkSFtp $sftp
exit
}
# ...
# ...
delete_CkSFtpDir $dirObj
# ------------------------------------------------------------------------
# Do the equivalent using ReadDirListing.
# Your application creates a new, empty SFtpDir object which is passed
# in the last argument and filled upon success.
set dirOut [new_CkSFtpDir]
set success [CkSFtp_ReadDirListing $sftp $handle $dirOut]
if {$success == 0} then {
puts [CkSFtp_lastErrorText $sftp]
delete_CkSFtp $sftp
delete_CkSFtpDir $dirOut
exit
}
# ...
# ...
CkSFtp_CloseHandle $sftp $handle
delete_CkSFtp $sftp
delete_CkSFtpDir $dirOut
|