PowerBuilder
PowerBuilder
Transition from SFtp.ReadDir to SFtp.ReadDirListing
Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Sftp
string ls_Handle
oleobject loo_DirObj
oleobject loo_DirOut
li_Success = 0
loo_Sftp = create oleobject
li_rc = loo_Sftp.ConnectToNewObject("Chilkat.SFtp")
if li_rc < 0 then
destroy loo_Sftp
MessageBox("Error","Connecting to COM object failed")
return
end if
// ...
// ...
ls_Handle = loo_Sftp.OpenDir(".")
// ...
// ...
// ------------------------------------------------------------------------
// The ReadDir method is deprecated:
loo_DirObj = loo_Sftp.ReadDir(ls_Handle)
if loo_Sftp.LastMethodSuccess = 0 then
Write-Debug loo_Sftp.LastErrorText
destroy loo_Sftp
return
end if
// ...
// ...
destroy loo_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.
loo_DirOut = create oleobject
li_rc = loo_DirOut.ConnectToNewObject("Chilkat.SFtpDir")
li_Success = loo_Sftp.ReadDirListing(ls_Handle,loo_DirOut)
if li_Success = 0 then
Write-Debug loo_Sftp.LastErrorText
destroy loo_Sftp
destroy loo_DirOut
return
end if
// ...
// ...
loo_Sftp.CloseHandle(ls_Handle)
destroy loo_Sftp
destroy loo_DirOut