Changeset 619 for trunk/gsdl/perllib/util.pm
- Timestamp:
- 1999-09-22T12:18:59+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/util.pm
r537 r619 27 27 28 28 use File::Copy; 29 use File::Basename; 29 30 30 31 … … 210 211 } 211 212 213 # make hard link to file if supported by OS, otherwise copy the file 214 sub hard_link { 215 my ($src,$dest) = @_; 216 217 # remove trailing slashes from source and destination files 218 $src =~ s/[\\\/]+$//; 219 $dest =~ s/[\\\/]+$//; 220 221 # a few sanity checks 222 if (!-e $src) { 223 print STDERR "util::hard_link source file $src does not exist\n"; 224 return; 225 } 226 elsif (-d $src) { 227 print STDERR "util::hard_link source $src is a directory\n"; 228 return; 229 } 230 231 my $dest_dir = &File::Basename::dirname($dest); 232 mk_all_dir($dest_dir) if (!-e $dest_dir); 233 234 if (!link($src,$dest)) 235 { 236 print STDERR "util::hard_link: unable to create hard link. "; 237 print STDERR " Attempting to copy file: $src -> $dest\n"; 238 &File::Copy::copy ($src, $dest); 239 } 240 241 } 242 243 244 212 245 213 246 # updates a copy of a directory in some other part of the filesystem … … 374 407 } 375 408 409 sub get_os_dirsep { 410 411 if ($ENV{'GSDLOS'} =~ /^windows$/i) { 412 return "\\\\"; 413 } else { 414 return "\\\/"; 415 } 416 } 417 418 sub get_re_dirsep { 419 420 return "\\\\|\\\/"; 421 } 422 376 423 377 424 # if this is running on windows we want binaries to end in
Note:
See TracChangeset
for help on using the changeset viewer.