I found a small bug in the method ::Driectory() of tFtp class. If cMask contains a filename that is not found on the ftp server, oWin32FindData:cFileName is not empty and seems to contain dummy value. So checking ::hFtpDir is the correct way.
- Code: Select all Expand view
- if ::hFTP != nil
cBuffer = oWin32FindData:cBuffer
hFTPDir = FtpFindFirstFile( ::hFTP, cMask, @cBuffer, 0, 0 )
oWin32FindData:cBuffer = cBuffer
//if ! Empty( oWin32FindData:cFileName )
if hFtpDir != 0 // changed !!
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow,;
FileTimeToDate( oWin32FindData:nLastWriteAccess ),;
FileTimeToTime( oWin32FindData:nLastWriteAccess ) } )
while InternetFindNextFile( hFTPDir, @cBuffer )
oWin32FindData:cBuffer = cBuffer
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow,;
FileTimeToDate( oWin32FindData:nLastWriteAccess ),;
FileTimeToTime( oWin32FindData:nLastWriteAccess ) } )
end
endif
InternetCloseHandle( hFTPDir )
endif