Changeset 15165
- Timestamp:
- 2008-04-02T18:11:24+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/util.pm
r15113 r15165 395 395 # make soft link to file if supported by OS, otherwise copy file 396 396 sub soft_link { 397 my ($src, $dest ) = @_;397 my ($src, $dest, $ensure_paths_absolute) = @_; 398 398 399 399 # remove trailing slashes from source and destination files 400 400 $src =~ s/[\\\/]+$//; 401 401 $dest =~ s/[\\\/]+$//; 402 403 # Ensure file paths are absolute IF requested to do so 404 # Soft_linking didn't work for relative paths 405 if(defined $ensure_paths_absolute && $ensure_paths_absolute) { 406 # We need to ensure that the src file is the absolute path 407 # See http://perldoc.perl.org/File/Spec.html 408 if(!File::Spec->file_name_is_absolute( $src )) { # it's relative 409 $src = File::Spec->rel2abs($src); # make absolute 410 } 411 # Might as well ensure that the destination file's absolute path is used 412 if(!File::Spec->file_name_is_absolute( $dest )) { 413 $dest = File::Spec->rel2abs($dest); # make absolute 414 } 415 } 402 416 403 417 # a few sanity checks
Note:
See TracChangeset
for help on using the changeset viewer.