Changeset 17571

Show
Ignore:
Timestamp:
23.10.2008 09:20:16 (11 years ago)
Author:
kjdon
Message:

moved the make_absolute function to util.pm

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/bin/script/buildcol.pl

    r17570 r17571  
    483483    else 
    484484      { 
    485         $archivedir = &make_absolute($ENV{'GSDLCOLLECTDIR'}, $archivedir); 
     485        $archivedir = &util::make_absolute($ENV{'GSDLCOLLECTDIR'}, $archivedir); 
    486486      } 
    487487    # End Mod 
     
    592592 
    593593 
    594 ## @method make_absolute() 
    595 # 
    596 #  Ensure the given file path is absolute in respect to the given base path. 
    597 # 
    598 #  @param  $base_dir A string denoting the base path the given dir must be 
    599 #                    absolute to. 
    600 #  @param  $dir The directory to be made absolute as a string. Note that the 
    601 #               dir may already be absolute, in which case it will remain 
    602 #               unchanged. 
    603 #  @return The now absolute form of the directory as a string. 
    604 # 
    605 #  @author John Thompson, DL Consulting Ltd. 
    606 #  @copy 2006 DL Consulting Ltd. 
    607 # 
    608 sub make_absolute() 
    609   { 
    610     my ($base_dir, $dir) = @_; 
    611     $dir =~ s/[\\\/]+/\//g; 
    612     $dir = $base_dir . "/$dir" unless ($dir =~ m#^(\w:)?/#);  
    613     $dir =~ s|^/tmp_mnt||; 
    614     1 while($dir =~ s|/[^/]*/\.\./|/|g); 
    615     $dir =~ s|/[.][.]?/|/|g; 
    616     $dir =~ tr|/|/|s; 
    617     return $dir; 
    618   } 
    619 ## make_absolute() ##