common/tools/ats/make_junction.pl
changeset 152 9b92bfde63bf
parent 113 7f0174848f99
equal deleted inserted replaced
151:78fd19fc42a0 152:9b92bfde63bf
    44 	help();
    44 	help();
    45 }
    45 }
    46 
    46 
    47 usage_error(), unless (defined($link) && defined($target));
    47 usage_error(), unless (defined($link) && defined($target));
    48 
    48 
    49 my $junction_help = `junction /?`;
    49 my $junction_help = `junction /accepteula /?`;
    50 die("Need command \"junction\". Not found\n"), if ($junction_help =~ /is not recognised/);
    50 die("Need command \"junction\". Not found\n"), if ($junction_help =~ /is not recognised/);
    51 die("Directory \"$target\" not found\n"), unless -d "$target";
    51 die("Directory \"$target\" not found\n"), unless -d "$target";
    52 
    52 
    53 my ($vol,$dir,$file) = File::Spec->splitpath($target);
    53 my ($vol,$dir,$file) = File::Spec->splitpath($target);
    54 my @subst_lines = `subst`;
    54 my @subst_lines = `subst`;
    80             $choice = lc($choice);
    80             $choice = lc($choice);
    81         }
    81         }
    82         $force = $choice eq 'y';
    82         $force = $choice eq 'y';
    83     }    
    83     }    
    84     if ($force) {
    84     if ($force) {
    85         system("junction -d \"$link\" > nul");
    85         system("junction /accepteula -d \"$link\" > nul");
    86         if ($?) {
    86         if ($?) {
    87             die("Cannot delete \"$link\": $!\n");
    87             die("Cannot delete \"$link\": $!\n");
    88         }
    88         }
    89         else {
    89         else {
    90             print "Deleted \"$link\"\n";
    90             print "Deleted \"$link\"\n";
    91         }
    91         }
    92     }
    92     }
    93 } 
    93 } 
    94 
    94 
    95 system("junction \"$link\" \"$target\" > nul");
    95 system("junction /accepteula \"$link\" \"$target\" > nul");
    96 if ($?) {
    96 if ($?) {
    97     die("Cannot cteate junction \"$link\" -> \"$target\": $!\n");
    97     die("Cannot cteate junction \"$link\" -> \"$target\": $!\n");
    98 }
    98 }
    99 else {
    99 else {
   100     print("Created junction \"$link\" -> \"$target\"\n");
   100     print("Created junction \"$link\" -> \"$target\"\n");