Changeset 14362


Ignore:
Timestamp:
2007-08-13T12:27:36+12:00 (17 years ago)
Author:
qq6
Message:

updated util.pm

File:
1 edited

Legend:

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

    r14329 r14362  
    2626package util;
    2727
     28BEGIN {                                                             
     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}                                                                   
    2834use File::Copy;
    2935use File::Basename;
     
    380386    # link not supported on windows 9x
    381387    if (($ENV{'GSDLOS'} =~ /^windows$/i) && (Win32::FsType() !~ /^ntfs$/i)) {
    382     print STDERR "util::hard_link: win32: using copy for hard link.\n";
    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);
     388        print STDERR "util::hard_link: win32: using copy for hard link.\n";
     389        &File::Copy::copy ($src, $dest);
     390    } else {
     391        require Win32::Hardlink;
     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        }
    389397    }
    390398    return 0;
     
    410418    # symlink not supported on windows
    411419    if ($ENV{'GSDLOS'} =~ /^windows$/i) {
    412      
    413420        if ( (Win32::FsType() =~ /^ntfs$/i) &&
    414421            ($src =~ /^.:\\.*/) && ($dest =~ /^.:\\.*/) &&
    415422            (substr($src,0,3) eq substr($dest,0,3)) ) {
    416        
    417423            # if filesystem is NTFS and both source and destination is on the same local drive,
    418424            # use hardlink instead of symlink
    419             #print STDERR "util::soft_link: win32: using hard link instead of soft ink.\n";
    420         require Win32::Hardlink;
    421         hard_link($src,$dest);
     425            #print STDERR "util::soft_link: win32: using hard link instead of soft ink.\n";
     426            hard_link($src,$dest);
    422427        } else {
    423428            #print STDERR "util::soft_link: win32: using copy for soft link.\n ";
Note: See TracChangeset for help on using the changeset viewer.