]> git.mxchange.org Git - flightgear.git/blob - Simulator/runfg
22a93414b74993a3654323a253c240034c836356
[flightgear.git] / Simulator / runfg
1 #!/usr/bin/perl
2
3 #---------------------------------------------------------------------------
4 # runfg -- front end for setting up the FG_ROOT env variable and launching 
5 #          the fg executable.
6 #
7 # Written by Curtis Olson, started September 1997.
8 #
9 # Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
10 #
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #
25 # $Id$
26 # (Log is kept at end of this file)
27 #---------------------------------------------------------------------------
28
29
30 # Flight Gear Version
31 $version_major = "0";
32
33 $path = "";
34
35 # name of Flight Gear executable
36 @programs = ( "fg" . $version_major, "fg" . $version_major . ".exe" );
37
38 # see if we can find the executable
39 while ( $path eq "" && ($program = shift(@programs)) ) {
40     print "$program\n";
41
42     if ( -x "./Main/$program" ) {
43         $path = "./Main/$program";
44     } elsif ( -x "./$program" ) {
45         $path = "./$program";
46     }
47 }
48
49 die "Cannot locate program.\n" if ( $path eq "" );
50
51
52 # set the FG_ROOT environment variable if it hasn't already been set.
53 if ( $ENV{FG_ROOT} eq "" ) {
54     # look for a file called fgtop as a place marker
55     if ( -e "fgtop" ) {
56         $ENV{FG_ROOT} = ".";
57     } elsif ( -e "../fgtop" ) {
58         $ENV{FG_ROOT} = "..";
59     }
60 }
61
62 # run Flight Gear
63 print "Running $path @ARGV\n";
64 exec("$path @ARGV");
65
66
67 #---------------------------------------------------------------------------
68 # $Log$
69 # Revision 1.4  1998/03/09 22:52:38  curt
70 # Mod's to better support win32 if perl exists.
71 #
72 # Revision 1.3  1998/02/16 16:17:34  curt
73 # Minor tweaks.
74 #
75 # Revision 1.2  1998/01/27 00:47:43  curt
76 # Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
77 # system and commandline/config file processing code.
78 #
79 # Revision 1.1  1997/10/28 18:47:27  curt
80 # Initial revision.
81 #