238 |
|
my ($arealocation, $toolname, $toolversion, $toolurl) = @_; |
239 |
|
my ($urlcache, $url, $filename, $tfname); |
240 |
|
my $toolfile; |
241 |
< |
|
241 |
> |
|
242 |
|
$toolname =~ tr[A-Z][a-z]; |
243 |
|
$toolversion ||= $self->defaultversion($toolname); |
244 |
|
$urlcache=URL::URLcache->new($arealocation."/.SCRAM/cache"); # Download tool cache |
245 |
< |
|
245 |
> |
|
246 |
|
# Check for the downloaded tools cache: |
247 |
|
if (defined($urlcache)) |
248 |
|
{ |
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 |
324 |
|
# Get file from download cache: |
325 |
|
($url,$filename)=$self->{urlhandler}->get($url); |
326 |
|
use File::Copy; |
327 |
< |
$tfname=$self->{toolfiledir}."/".$toolname; |
327 |
> |
$tfname=$self->{toolfiledir}."/".$toolname; |
328 |
|
copy($filename, $tfname); |
329 |
+ |
my $mode = 0644; chmod $mode, $tfname; |
330 |
|
$toolfile=$tfname; |
331 |
|
} |
332 |
|
else |