Subversion Repositories gelsvn

Rev

Rev 107 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 107 Rev 198
Line 3... Line 3...
3
    if 0;
3
    if 0;
4
 
4
 
5
# ******************************************************************
5
# ******************************************************************
6
#      Author: Chad Elliott
6
#      Author: Chad Elliott
7
#        Date: 6/17/2002
7
#        Date: 6/17/2002
8
#         $Id: mwc.pl 107 2005-09-02 16:42:23Z bj $
8
#         $Id: mwc.pl 198 2005-12-15 11:30:53Z bj $
9
# ******************************************************************
9
# ******************************************************************
10
 
10
 
11
# ******************************************************************
11
# ******************************************************************
12
# Pragma Section
12
# Pragma Section
13
# ******************************************************************
13
# ******************************************************************
14
 
14
 
15
use strict;
15
use strict;
16
use Cwd;
16
use Cwd;
17
use Config;
17
use Config;
-
 
18
use FindBin;
18
use File::Basename;
19
use File::Basename;
19
 
20
 
20
my($basePath) = getExecutePath($0);
21
my($basePath) = $FindBin::Bin;
21
unshift(@INC, $basePath . '/modules');
22
unshift(@INC, $basePath . '/modules');
22
 
23
 
23
require MWC;
24
require MWC;
24
 
25
 
25
# ************************************************************
26
# ************************************************************
Line 28... Line 29...
28
 
29
 
29
sub getBasePath {
30
sub getBasePath {
30
  return $basePath;
31
  return $basePath;
31
}
32
}
32
 
33
 
33
 
-
 
34
sub which {
-
 
35
  my($prog) = shift;
-
 
36
  my($exec) = $prog;
-
 
37
 
-
 
38
  if (defined $ENV{'PATH'}) {
-
 
39
    my($part)   = '';
-
 
40
    my($envSep) = $Config{'path_sep'};
-
 
41
    foreach $part (split(/$envSep/, $ENV{'PATH'})) {
-
 
42
      $part .= "/$prog";
-
 
43
      if ( -x $part ) {
-
 
44
        $exec = $part;
-
 
45
        last;
-
 
46
      }
-
 
47
    }
-
 
48
  }
-
 
49
 
-
 
50
  return $exec;
-
 
51
}
-
 
52
 
-
 
53
 
-
 
54
sub getExecutePath {
-
 
55
  my($prog) = shift;
-
 
56
  my($loc)  = '';
-
 
57
 
-
 
58
  if ($prog ne basename($prog)) {
-
 
59
    if ($prog =~ /^[\/\\]/ ||
-
 
60
        $prog =~ /^[A-Za-z]:[\/\\]?/) {
-
 
61
      $loc = dirname($prog);
-
 
62
    }
-
 
63
    else {
-
 
64
      $loc = getcwd() . '/' . dirname($prog);
-
 
65
    }
-
 
66
  }
-
 
67
  else {
-
 
68
    $loc = dirname(which($prog));
-
 
69
  }
-
 
70
 
-
 
71
  if ($loc eq '.') {
-
 
72
    $loc = getcwd();
-
 
73
  }
-
 
74
 
-
 
75
  if ($loc ne '') {
-
 
76
    $loc .= '/';
-
 
77
  }
-
 
78
 
-
 
79
  return $loc;
-
 
80
}
-
 
81
 
-
 
82
 
-
 
83
# ************************************************************
34
# ************************************************************
84
# Main Section
35
# Main Section
85
# ************************************************************
36
# ************************************************************
86
 
37
 
87
my($driver) = new MWC();
38
my($driver) = new MWC();