Revision: | 1.13 |
Committed: | Wed Feb 2 20:16:46 2005 UTC (20 years, 3 months ago) by sashby |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | V1_1_7, V1_1_6, V1_1_5, V1_2_0-cand3, V1_2_0-cand2, V1_2_0-cand1, V1_1_4, V1_1_3, V1_1_2, V1_1_0_reltag8, V1_1_0_reltag7, V1_1_0_reltag6, V1_1_1, V1_1_0_reltag5, V1_1_0_reltag4, V1_1_0_reltag3, V1_1_0_reltag2, V1_1_0_reltag1, V1_1_0_reltag, V1_0_3-p4, V1_1_0_cand3, V1_1_0_cand2, V1_1_0_cand1, HEAD_SM_071214, forV1_1_0, v103_xml_071106, V1_0_3-p3, V1_0_3-p2, V1_1_0, v110p1, V110p6, V110p5, V110p4, V110p3, before110xmlBRmerge, V110p2, V110p1, V1_0_4p1, V1_0_3-p1, V1_0_3, V1_0_2, V1_0_2_p1, v102p1, V1_0_1 |
Branch point for: | forBinLess_SCRAM, HEAD_BRANCH_SM_071214, v200branch, v103_with_xml, v103_branch |
Changes since 1.12: | +1 -2 lines |
Log Message: | Some more tidying of file permissions for downloaded/cached files. |
# | User | Rev | Content |
---|---|---|---|
1 | williamc | 1.1 | # |
2 | # standard url interface for local file | ||
3 | # | ||
4 | # Interface | ||
5 | # --------- | ||
6 | # new() : | ||
7 | # get(url, destination) : | ||
8 | |||
9 | williamc | 1.4 | package URL::URL_file; |
10 | williamc | 1.1 | require 5.001; |
11 | use File::Copy; | ||
12 | williamc | 1.9 | use URL::URL_base; |
13 | @ISA=qw(URL::URL_base); | ||
14 | williamc | 1.1 | |
15 | sub get { | ||
16 | my $self=shift; | ||
17 | williamc | 1.5 | my $url=shift; |
18 | my $location=shift; | ||
19 | williamc | 1.8 | my $filename=$url->path(); |
20 | sashby | 1.13 | |
21 | williamc | 1.5 | if ( -e $filename ) { |
22 | williamc | 1.10 | if ( -d $filename ) { #- directory copy |
23 | require Utilities::AddDir; | ||
24 | AddDir::copydir($filename,$location); | ||
25 | } | ||
26 | else { | ||
27 | copy ( $filename,$location) || die "Unable to copy file $filename --> " | ||
28 | williamc | 1.5 | ."$location \n$!\n"; |
29 | williamc | 1.10 | } |
30 | williamc | 1.5 | $rv=$location; |
31 | williamc | 1.1 | } |
32 | else { | ||
33 | williamc | 1.3 | $rv=""; |
34 | williamc | 1.1 | } |
35 | williamc | 1.3 | return $rv; |
36 | williamc | 1.1 | } |