Downloading to a read-only file and progress in SS - WeOnlyDo Discussion board

Downloading to a read-only file and progress in SS (wodSFTP / wodSFTP.NET / wodSFTPdll)

by gn, Wednesday, October 12, 2005, 18:56 (6776 days ago)

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

by wodSupport, Wednesday, October 12, 2005, 20:08 (6776 days ago) @ gn

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

by gn, Wednesday, October 12, 2005, 22:25 (6776 days ago) @ wodSupport

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

by wodSupport, Thursday, October 13, 2005, 04:33 (6775 days ago) @ gn

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

by gn, Thursday, October 13, 2005, 19:06 (6775 days ago) @ wodSupport

How do you handle 'Error' object in MSVC++?

Re: Downloading to a read-only file and progress i

by wodSupport, Thursday, October 13, 2005, 20:32 (6775 days ago) @ gn

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

by gn, Thursday, October 13, 2005, 22:01 (6775 days ago) @ wodSupport

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

by wodSupport, Thursday, October 13, 2005, 23:21 (6775 days ago) @ gn

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

by gn, Friday, October 14, 2005, 00:22 (6775 days ago) @ wodSupport

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

by wodSupport, Friday, October 14, 2005, 00:27 (6775 days ago) @ gn

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

by gn, Friday, October 14, 2005, 01:01 (6774 days ago) @ wodSupport

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

by wodSupport, Friday, October 14, 2005, 01:57 (6774 days ago) @ gn

True, found it and fixed it.

Re: Downloading to a read-only file and progress i

by gn, Friday, October 14, 2005, 17:14 (6774 days ago) @ wodSupport

Cool. Is the fix avalable?

Re: Downloading to a read-only file and progress i

by wodSupport, Friday, October 14, 2005, 18:23 (6774 days ago) @ gn

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

by gn, Friday, October 14, 2005, 19:26 (6774 days ago) @ wodSupport

Thanks, the fix works.

-gn