diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2005-11-21 15:26:51 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2005-11-21 15:26:51 +0000 |
commit | e5a235cad6a624d1be41543636a80fc526f906a5 (patch) | |
tree | 57fe99174a258fe3e8cfc36f1afbc880fcf2bdad /mpc.pl | |
parent | f003a7abf1334fda4548db353ffac931916d9309 (diff) | |
download | MPC-e5a235cad6a624d1be41543636a80fc526f906a5.tar.gz |
ChangeLogTag: Mon Nov 21 09:26:35 2005 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'mpc.pl')
-rwxr-xr-x | mpc.pl | 53 |
1 files changed, 2 insertions, 51 deletions
@@ -15,9 +15,10 @@ eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' use strict; use Cwd; use Config; +use FindBin; use File::Basename; -my($basePath) = getExecutePath($0); +my($basePath) = $FindBin::Bin; unshift(@INC, $basePath . '/modules'); require MPC; @@ -30,56 +31,6 @@ sub getBasePath { return $basePath; } - -sub which { - my($prog) = shift; - my($exec) = $prog; - - if (defined $ENV{'PATH'}) { - my($part) = ''; - my($envSep) = $Config{'path_sep'}; - 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; -} - - # ************************************************************ # Main Section # ************************************************************ |