[wpkg-users] Problems with Downloading capability, or just PEBKAC ?

Rainer Meier r.meier at wpkg.org
Tue Apr 17 00:45:15 CEST 2012


Hi Neil,

On 16.04.2012 20:20, neilr8133 wrote:
> Trying to figure out a few things about the downloading capabilities and whether I'm experiencing a bug in the code or if it's a PEBKAC error.
>
> 1) When using the<download>  directive, it seems that the target folder is always rooted at %TMP% ?  I see nothing in the docs about a limitation (although it would make sense for security reasons) but that's the behavior I see..

Indeed it's relative to the downloadDir property (see config.xml). The 
documentation in XSD says:

"target" attribute:

Target path to store the file to. The path has to be
specified relative to the downloadDir property
within config.xml. By default relative to %TEMP%.
For example specify 'pidgin\pidgin.exe' to download
the file at the specified URL to
'%TEMP%\pidgin\pigin.exe'. The file is removed after
the commands are executed.


If you need more flexibility we do recommend to either use downloader.cmd which 
is much more flexible and also allows checking the download. Alternatively feel 
free to use any alternative downloading tool.


> 2) I see a contradiction between the docs and downloader.cmd in that one says we can put downloading tools (like robocopy.exe) into tools\downloader but the other says that robocopy has to be pushed out to clients for use.  Which is correct?  (Looking through downloader.cmd I see that wget and the md5/sha1 calculators are picked up from the tools\downloader folder but robocopy isn't ?)

Robocopy is (AFAIK) integrated part of Windows 7. So no need for deployment 
here. However for older versions you might need to deploy it. Alternatively just 
put it into the same folder as downloader.cmd. If robocopy.exe exist in the same 
folder as downloader.cmd it will be run from this folder rather than from the 
system location. But read on...


> 2b) Maybe I'm being dense, but what's the purpose of line 45 in downloader.cmd ?  The intent of the line as a whole is unclear, and also it seems like a syntax error to have that `0' in the middle of the string...

Indeed I think you've spotted a bug. Line 45 should read as follows:

if exist "%TOOLS_PATH%robocopy.exe" "%TOOLS_PATH%robocopy.exe"

Its purpose is to check whether robocopy.exe exists within the same folder as 
downloader.cmd. If found it's used. If not found it's ignored and downloader.cmd 
will try to use robocopy.exe somewhere in the system path (if available).

The "0" which was in there was not a syntax error, but definitely wrong since 
you would have to name your "robocopy.exe" "0robocopy.exe" in order to be used. 
That's all. I think the bug came from the fact that I was used to use 
"%~dp0robocopy.exe" before, then "%~dp0" was replace by "%TOOLS_PATH%" and I 
have missed to remove the "0". I guess I did not notice during testing because I 
am using Windows 7 only and therefore I don't need to deploy robocopy.exe on the 
share.

Thanks for reporting the issue.

An updated version of downloader.cmd is available on SVN:

FIX: Fixed downloader.cmd bug to read robocopy.exe from same folder where
      downloader.cmd is stored (if present).
      Thanks to Neil for reporting.

<http://wpkg.svn.sourceforge.net/viewvc/wpkg/wpkg/stable/src/main/resources/wpkg/tools/downloader/>

br,
Rainer



More information about the wpkg-users mailing list