248 |
|
{ |
249 |
|
$self->{urlhandler}=URL::URLhandler->new($urlcache); |
250 |
|
} |
251 |
< |
|
251 |
> |
|
252 |
|
$url = $self->toolurls()->{$toolname}; |
253 |
|
$filename = $self->{toolfiledir}."/".$toolname; |
254 |
|
|
255 |
+ |
# If .SCRAM/InstalledTools doesn't exist, create it: |
256 |
+ |
if (! -d $self->{toolfiledir}) |
257 |
+ |
{ |
258 |
+ |
AddDir::adddir($self->{toolfiledir}); |
259 |
+ |
} |
260 |
+ |
|
261 |
|
# First, check to see if there was a tool URL given. If so, we might need to read |
262 |
|
# from http or from a file: type URL: |
263 |
|
if (my ($proto, $urlv) = ($toolurl =~ /(.*):(.*)/)) |
272 |
|
{ |
273 |
|
use File::Copy; |
274 |
|
copy($urlv, $filename); |
275 |
+ |
my $mode = 0644; chmod $mode, $filename; |
276 |
|
$toolfile=$filename; |
277 |
|
} |
278 |
|
else |
320 |
|
# Copy the downloaded tool file to InstalledTools directory: |
321 |
|
if ( ! -f $filename ) |
322 |
|
{ |
323 |
< |
$self->verbose("Attempting Download of $url"); |
324 |
< |
# Get file from download cache: |
325 |
< |
($url,$filename)=$self->{urlhandler}->get($url); |
326 |
< |
use File::Copy; |
327 |
< |
$tfname=$self->{toolfiledir}."/".$toolname; |
328 |
< |
copy($filename, $tfname); |
329 |
< |
$toolfile=$tfname; |
323 |
> |
# If the URL is empty, the chances are that this tool was not downloaded to .SCRAM/InstalledTools. |
324 |
> |
# We signal an error and exit: |
325 |
> |
if ($url eq '') |
326 |
> |
{ |
327 |
> |
$::scram->scramerror("$toolname was selected in project requirements but is not in the configuration!"); |
328 |
> |
} |
329 |
> |
else |
330 |
> |
{ |
331 |
> |
# Otherwise, we try to download it: |
332 |
> |
$self->verbose("Attempting Download of $url"); |
333 |
> |
# Get file from download cache: |
334 |
> |
($url,$filename)=$self->{urlhandler}->get($url); |
335 |
> |
use File::Copy; |
336 |
> |
$tfname=$self->{toolfiledir}."/".$toolname; |
337 |
> |
copy($filename, $tfname); |
338 |
> |
my $mode = 0644; chmod $mode, $tfname; |
339 |
> |
$toolfile=$tfname; |
340 |
> |
} |
341 |
|
} |
342 |
|
else |
343 |
|
{ |