Changeset 17572 for gsdl/trunk/perllib/util.pm
- Timestamp:
- 2008-10-23T09:20:46+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/util.pm
r17512 r17572 768 768 } 769 769 770 ## @method make_absolute() 771 # 772 # Ensure the given file path is absolute in respect to the given base path. 773 # 774 # @param $base_dir A string denoting the base path the given dir must be 775 # absolute to. 776 # @param $dir The directory to be made absolute as a string. Note that the 777 # dir may already be absolute, in which case it will remain 778 # unchanged. 779 # @return The now absolute form of the directory as a string. 780 # 781 # @author John Thompson, DL Consulting Ltd. 782 # @copy 2006 DL Consulting Ltd. 783 # 784 #used in buildcol.pl, doesn't work for all cases --kjdon 785 sub make_absolute { 786 787 my ($base_dir, $dir) = @_; 788 print STDERR "dir = $dir\n"; 789 $dir =~ s/[\\\/]+/\//g; 790 $dir = $base_dir . "/$dir" unless ($dir =~ m|^(\w:)?/|); 791 $dir =~ s|^/tmp_mnt||; 792 1 while($dir =~ s|/[^/]*/\.\./|/|g); 793 $dir =~ s|/[.][.]?/|/|g; 794 $dir =~ tr|/|/|s; 795 print STDERR "dir = $dir\n"; 796 797 return $dir; 798 } 799 ## make_absolute() ## 770 800 771 801 sub get_dirsep {
Note:
See TracChangeset
for help on using the changeset viewer.