Changeset 14365 for gsdl/trunk/perllib/util.pm
- Timestamp:
- 2007-08-13T13:42:34+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/util.pm
r14364 r14365 26 26 package util; 27 27 28 BEGIN {29 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};30 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};31 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");32 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");33 }34 28 use File::Copy; 35 29 use File::Basename; 30 36 31 37 32 # removes files (but not directories) … … 386 381 # link not supported on windows 9x 387 382 if (($ENV{'GSDLOS'} =~ /^windows$/i) && (Win32::FsType() !~ /^ntfs$/i)) { 388 require Win32::Hardlink; 389 print STDERR "util::hard_link: win32: using copy for hard link.\n"; 390 &File::Copy::copy ($src, $dest); 391 } else { 392 if (!link($src, $dest)) { 393 print STDERR "util::hard_link: unable to create hard link. "; 394 print STDERR " Attempting to copy file: $src -> $dest\n"; 395 &File::Copy::copy ($src, $dest); 396 } 383 &File::Copy::copy ($src, $dest); 384 385 } elsif (!link($src, $dest)) { 386 print STDERR "util::hard_link: unable to create hard link. "; 387 print STDERR " Attempting to copy file: $src -> $dest\n"; 388 &File::Copy::copy ($src, $dest); 397 389 } 398 390 return 0; … … 415 407 my $dest_dir = &File::Basename::dirname($dest); 416 408 mk_all_dir($dest_dir) if (!-e $dest_dir); 417 418 # symlink not supported on windows 409 419 410 if ($ENV{'GSDLOS'} =~ /^windows$/i) { 420 if ( (Win32::FsType() =~ /^ntfs$/i) && 421 ($src =~ /^.:\\.*/) && ($dest =~ /^.:\\.*/) && 422 (substr($src,0,3) eq substr($dest,0,3)) ) { 423 # if filesystem is NTFS and both source and destination is on the same local drive, 424 # use hardlink instead of symlink 425 #print STDERR "util::soft_link: win32: using hard link instead of soft ink.\n"; 426 hard_link($src,$dest); 427 } else { 428 #print STDERR "util::soft_link: win32: using copy for soft link.\n "; 429 &File::Copy::copy ($src, $dest); 430 } 411 # symlink not supported on windows 412 &File::Copy::copy ($src, $dest); 431 413 432 414 } elsif (!eval {symlink($src, $dest)}) {
Note:
See TracChangeset
for help on using the changeset viewer.