Changeset 14365

Show
Ignore:
Timestamp:
13.08.2007 13:42:34 (12 years ago)
Author:
qq6
Message:

the hard_link on windows didn't work, get back to the old version

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/util.pm

    r14364 r14365  
    2626package util; 
    2727 
    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 }                                                                    
    3428use File::Copy; 
    3529use File::Basename; 
     30 
    3631 
    3732# removes files (but not directories) 
     
    386381    # link not supported on windows 9x 
    387382    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); 
    397389    } 
    398390    return 0; 
     
    415407    my $dest_dir = &File::Basename::dirname($dest); 
    416408    mk_all_dir($dest_dir) if (!-e $dest_dir); 
    417          
    418     # symlink not supported on windows 
     409 
    419410    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); 
    431413 
    432414    } elsif (!eval {symlink($src, $dest)}) {