[interchange-cvs] interchange - jon modified lib/Vend/File.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Tue Jan 30 14:23:29 EST 2007


User:      jon
Date:      2007-01-30 19:23:28 GMT
Modified:  lib/Vend File.pm
Log:
Add make_absolute_file routine. Kind of important since my commit of
Require PerlInclude yesterday depends on it.

Revision  Changes    Path
2.23      +13 -2     interchange/lib/Vend/File.pm


rev 2.23, prev_rev 2.22
Index: File.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/File.pm,v
retrieving revision 2.22
retrieving revision 2.23
diff -u -u -r2.22 -r2.23
--- File.pm	5 Apr 2006 14:42:19 -0000	2.22
+++ File.pm	30 Jan 2007 19:23:28 -0000	2.23
@@ -1,6 +1,6 @@
 # Vend::File - Interchange file functions
 #
-# $Id: File.pm,v 2.22 2006/04/05 14:42:19 mheins Exp $
+# $Id: File.pm,v 2.23 2007/01/30 19:23:28 jon Exp $
 # 
 # Copyright (C) 2002-2005 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -55,7 +55,7 @@
 use File::Copy;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK $errstr);
-$VERSION = substr(q$Revision: 2.22 $, 10);
+$VERSION = substr(q$Revision: 2.23 $, 10);
 
 sub writefile {
     my($file, $data, $opt) = @_;
@@ -396,6 +396,17 @@
 sub absolute_or_relative {
     my($file) = @_;
     $file =~ $abspat or $file =~ $relpat;
+}
+
+sub make_absolute_file {
+	my ($path, $global) = @_;
+	# empty string stays empty
+	return unless length($path);
+	# is file already an absolute path?
+	return $path if $path =~ $abspat;
+	# use global or catalog root?
+	my $prefix = ($global ? $Global::VendRoot : $Vend::Cfg->{VendRoot});
+	return catfile($prefix, $path);
 }
 
 sub win_catfile {








More information about the interchange-cvs mailing list