Downloading to a read-only file and progress in SS (wodSFTP / wodSFTP.NET / wodSFTPdll)
Hi,
I've started evaluating your FTP component (wodFtpDLXCom), and it seems better that other ones I tried. A couple of question so far:
1. When I use GetFile(), and the local target file is read-only, the function returns immediately, but there's no error in the Done event.
2. When I use SFTP (over OpenSSH), the last Progress event comes with Position=0.
Thanks,
-gn
Re: Downloading to a read-only file and progress i
GN,
hi.
1. When I use GetFile(), and the local target file is read-only, the function returns immediately, but there's no error in the Done event.
Did you check for errors returned by GetFile? Perhaps it returned some sort of 'permission denied' error already?
2. When I use SFTP (over OpenSSH), the last Progress event comes with Position=0.
Hmm, we didn't have such reports so far. You are downloading file, right? I have to see if I can duplicate that.
Regards,
Kreso
Re: Downloading to a read-only file and progress i
Kreso,
Did you check for errors returned by GetFile? Perhaps it returned some sort of 'permission denied' error already?
According to the Help (and my degugging), GetFile does not return a value.
Hmm, we didn't have such reports so far. You are downloading file, right?
Yes.
-gn
Re: Downloading to a read-only file and progress i
GN,
According to the Help (and my degugging), GetFile does not return a value.
No, GetFile doesn't return anything directly. It sets up 'Error' object which is handled differently by programming environment. In VB it's, for example, 'Error' object (On Error Resume Next...)
wodFtpDLX should throw 30024 if it cannot open local file, can you double check that? Perhaps it was thrown?
Re: Downloading to a read-only file and progress i
How do you handle 'Error' object in MSVC++?
Re: Downloading to a read-only file and progress i
That's not easy to answer. Depends on project type. Try to step in into GetFile, to see wrapper made by MFC. You will see that eventually it calls GetFile and takes back long value (HRESULT actually). If result != 0 then it usually throws an exception.
ATL handles is differently, etc..
You could zip your project and send it overhere, I will take a look and try to make error handler for you.
Re: Downloading to a read-only file and progress i
I'm using your WithEvents MFC sample. And eventually GetFile calls COleDispatchDriver::InvokeHelperV, which has the following:
[code]SCODE sc = m_lpDispatch->Invoke(dwDispID, IID_NULL, 0, wFlags, &dispparams, pvarResult, &excepInfo, &nArgErr);[/code]
The sc is 0 (successfull), and excepInfo has nothing.
Re: Downloading to a read-only file and progress i
Gn,
this was a bug - we detected the error but didn't returned it. Now it's fixed. Please download wodFtpDLX again, or request update if you're licensed user.
BTW, now when you test, in OLEDISP1.cpp line 1017 you will see error is trapped in CATCH_ALL(e). It will probably be re-thrown to your code.
Re: Downloading to a read-only file and progress i
The latest build does throw the following exception Error occurred trying to write to local file. This is fine, I can use exceptions blocks around the calls to wodFtpDLX. Still, why the Done event is not automatically generated with the error? Isn't it what the Helps says:
[code]For each method issued by the user (MakeDir, ListDir, DeleteFile...) this event will be fired to signalize that method has completed, and that it was (successfully) executed. If error occurred, ErrorCode will contain non-zero error code that determines the error. In such case, ErrorText will contain string representation of the error - if it was provided by the server, your OS or the wodFtpDLX itself.[/code]
Thanks,
-gn
Re: Downloading to a read-only file and progress i
Gn,
component never gets that far to start anything - it returns much before, that's why Done isn't fired.
Re: Downloading to a read-only file and progress i
OK, I think I'll just surround all calls with try-catch.
Now, to my second question:
2. When I use SFTP (over OpenSSH), the last Progress event comes with Position=0.
Thanks,
-gn
Re: Downloading to a read-only file and progress i
True, found it and fixed it.
Re: Downloading to a read-only file and progress i
Cool. Is the fix avalable?
Re: Downloading to a read-only file and progress i
Yes, if you use demo, then download it again. If you're licensed user, go to http://www.weonlydo.com/index.asp?update=1 and request update.
Re: Downloading to a read-only file and progress i
Thanks, the fix works.
-gn