Home | History | Annotate | Download | only in Scripts
      1 #!/usr/bin/perl -w
      2 
      3 use strict;
      4 use warnings;
      5 
      6 use File::Temp qw/tempfile/;
      7 use FindBin;
      8 
      9 use lib $FindBin::Bin;
     10 use webkitdirs;
     11 
     12 my ($fh, $path) = tempfile(UNLINK => 0, SUFFIX => '.cmd') or die;
     13 
     14 chomp(my $vcBin = `cygpath -w "$FindBin::Bin/../vcbin"`);
     15 chomp(my $scriptsPath = `cygpath -w "$FindBin::Bin"`);
     16 
     17 my $vsToolsVar;
     18 if ($ENV{'VS80COMNTOOLS'}) {
     19     $vsToolsVar = "VS80COMNTOOLS";
     20 } elsif ($ENV{'VS90COMNTOOLS'}) {
     21     $vsToolsVar = "VS90COMNTOOLS";
     22 } else {
     23     print "*************************************************************\n";
     24     print "Cannot find Visual Studio tools dir.\n";
     25     print "Please ensure that \$VS80COMNTOOLS or \$VS90COMNTOOLS\n";
     26     print "is set to a valid location.\n";
     27     print "*************************************************************\n";
     28     die;
     29 }
     30 
     31 print $fh "\@echo off\n\n";
     32 print $fh "call \"\%" . $vsToolsVar . "\%\\vsvars32.bat\"\n\n";
     33 print $fh "set PATH=$vcBin;$scriptsPath;\%PATH\%\n\n";
     34 
     35 print $fh "IF EXIST \"\%VSINSTALLDIR\%\\Common7\\IDE\\devenv.com\" (devenv.com /useenv " . join(" ", @ARGV) . ") ELSE ";
     36 print $fh "VCExpress.exe /useenv " . join(" ", @ARGV) . "\n";
     37 
     38 
     39 close $fh;
     40 
     41 chmod 0755, $path;
     42 
     43 chomp($path = `cygpath -w -s '$path'`);
     44 
     45 exec("cmd /c \"call $path\"");
     46