summaryrefslogtreecommitdiffstats
path: root/urpm/util.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-07 13:40:23 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-07 13:40:23 +0000
commit0977b27affca5e32b01cfab810f8ca5919691c0c (patch)
treefe6b5466fc289c6aecbd6a7aba3e2305f2e5494b /urpm/util.pm
parent1d542c9fe7709ae0a25b3289aa148734f75a4b1a (diff)
downloadurpmi-0977b27affca5e32b01cfab810f8ca5919691c0c.tar
urpmi-0977b27affca5e32b01cfab810f8ca5919691c0c.tar.gz
urpmi-0977b27affca5e32b01cfab810f8ca5919691c0c.tar.bz2
urpmi-0977b27affca5e32b01cfab810f8ca5919691c0c.tar.xz
urpmi-0977b27affca5e32b01cfab810f8ca5919691c0c.zip
create file2absolute_file() and use it
Diffstat (limited to 'urpm/util.pm')
-rw-r--r--urpm/util.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/urpm/util.pm b/urpm/util.pm
index 09b20467..4c51d2ff 100644
--- a/urpm/util.pm
+++ b/urpm/util.pm
@@ -16,6 +16,7 @@ our @EXPORT = qw(min max quotespace unquotespace
difference2 intersection member
file_size cat_ cat_utf8 wc_l
output_safe append_to_file dirname basename
+ file2absolute_file
);
(our $VERSION) = q($Revision$) =~ /(\d+)/;
@@ -31,6 +32,16 @@ sub remove_internal_name { my $x = $_[0] || ''; $x =~ s/\(\S+\)$/$1/g; $x }
sub dirname { local $_ = shift; s|[^/]*/*\s*$||; s|(.)/*$|$1|; $_ || '.' }
sub basename { local $_ = shift; s|/*\s*$||; s|.*/||; $_ }
+sub file2absolute_file {
+ my ($f) = @_;
+
+ if ($f !~ m!^/!) {
+ require File::Spec;
+ $f = File::Spec->rel2abs($f);
+ }
+ $f;
+}
+
#- reduce pathname by removing <something>/.. each time it appears (or . too).
sub reduce_pathname {
my ($url) = @_;