diff options
Diffstat (limited to 'bin/mwc.pl')
-rwxr-xr-x | bin/mwc.pl | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/bin/mwc.pl b/bin/mwc.pl new file mode 100755 index 00000000000..7e7ee31f7d9 --- /dev/null +++ b/bin/mwc.pl @@ -0,0 +1,97 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# ****************************************************************** +# Author: Chad Elliott +# Date: 6/17/2002 +# $Id$ +# ****************************************************************** + +# ****************************************************************** +# Pragma Section +# ****************************************************************** + +use strict; +use Cwd; +use File::Basename; + +my($basePath) = getExecutePath($0) . "/MakeProjectCreator"; +unshift(@INC, $basePath . "/modules"); + +require Driver; + +# ************************************************************ +# Data Section +# ************************************************************ + +my(@creators) = ('GNUWorkspaceCreator', + 'NMakeWorkspaceCreator', + 'VC6WorkspaceCreator', + 'VC7WorkspaceCreator', + 'BorlandWorkspaceCreator', + 'GHSWorkspaceCreator', + 'EM3WorkspaceCreator', + 'VA4WorkspaceCreator', + ); + +# ************************************************************ +# Subroutine Section +# ************************************************************ + +sub which { + my($prog) = shift; + my($exec) = "$prog"; + my($part) = ""; + my($isWin) = ($^O eq "MSWin32"); + my($envSep) = ($isWin ? ";" : ":"); + + if (defined $ENV{'PATH'}) { + foreach $part (split(/$envSep/, $ENV{'PATH'})) { + $part .= "/$prog"; + if ( -x $part ) { + $exec = $part; + last; + } + } + } + + return $exec; +} + + +sub getExecutePath { + my($prog) = shift; + my($loc) = ""; + + if ($prog ne basename($prog)) { + if ($prog =~ /^[\/\\]/ || + $prog =~ /^[A-Za-z]:[\/\\]?/) { + $loc = dirname($prog); + } + else { + $loc = getcwd() . "/" . dirname($prog); + } + } + else { + $loc = dirname(which($prog)); + } + + if ($loc eq ".") { + $loc = getcwd(); + } + + if ($loc ne "") { + $loc .= "/"; + } + + return $loc; +} + + +# ************************************************************ +# Subroutine Section +# ************************************************************ + +my($driver) = new Driver($basePath, basename($0), @creators); +exit($driver->run(@ARGV)); |