FoxPro and .NET Interop
wwFtpClient.prg:CreateDirectory don't use the Fluent .NET Interop object
Hi Rick,
the function CreateDirectory() is a copy of depricated wwFtp.prg and don't work in wwFtpClient.prg
Wrong code as copy of wwFtp.prg
FUNCTION CreateDirectory()
LPARAMETER lcPath
IF EMPTY(lcPath)
RETURN .F.
ENDIF
DECLARE INTEGER FtpCreateDirectory ;
IN WININET.DLL ;
INTEGER hConnect,;
STRING lpszDirectory
IF FtpCreateDirectory(THIS.hftpsession,lcPath)=0
THIS.nError = GetLastError()
THIS.cErrorMsg = THIS.GetSystemErrorMsg()
RETURN .F.
ENDIF
RETURN .T.
ENDFUNC
Solution to resolve this bug
FUNCTION CreateDirectory()
LPARAMETER lcPath
IF EMPTY(lcPath)
RETURN .F.
ENDIF
IF !this.oFtpClient.CreateDirectory(lcPath)
THIS.cErrorMsg = this.oFtpClient.ErrorMessage
RETURN .F.
ENDIF
RETURN .T.
ENDFUNC
Please fix / implement this in one of you next versions.
Thank you,
Fixed on this end. The function exists in the .NET code and you can fix with:
************************************************************************
* CreateDirectory
****************************************
*** Function: Creates a directory on the server.
*** Assume:
*** Pass: lcPath - Server relative path to create
*** Return:
************************************************************************
FUNCTION CreateDirectory()
LPARAMETER lcPath
IF EMPTY(lcPath)
THIS.cErrorMsg = "You must provide a path to CreateDirectory()."
RETURN .F.
ENDIF
IF !this.oFtpClient.CreateDirectory(lcPath)
THIS.cErrorMsg = this.oFtpClient.ErrorMessage
RETURN .F.
ENDIF
RETURN .T.
ENDFUNC
+++ Rick ---