1998-01-27 00:47:41 +00:00
|
|
|
#!/usr/bin/perl
|
1997-10-28 18:47:27 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
# runfg -- front end for setting up the FG_ROOT env variable and launching
|
|
|
|
# the fg executable.
|
|
|
|
#
|
|
|
|
# Written by Curtis Olson, started September 1997.
|
|
|
|
#
|
|
|
|
# Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
# (Log is kept at end of this file)
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
# Flight Gear Version
|
|
|
|
$version_major = "0";
|
|
|
|
|
1998-03-09 22:52:38 +00:00
|
|
|
$path = "";
|
|
|
|
|
1997-10-28 18:47:27 +00:00
|
|
|
# name of Flight Gear executable
|
1998-03-09 22:52:38 +00:00
|
|
|
@programs = ( "fg" . $version_major, "fg" . $version_major . ".exe" );
|
1997-10-28 18:47:27 +00:00
|
|
|
|
|
|
|
# see if we can find the executable
|
1998-03-09 22:52:38 +00:00
|
|
|
while ( $path eq "" && ($program = shift(@programs)) ) {
|
|
|
|
print "$program\n";
|
|
|
|
|
|
|
|
if ( -x "./Main/$program" ) {
|
|
|
|
$path = "./Main/$program";
|
|
|
|
} elsif ( -x "./$program" ) {
|
|
|
|
$path = "./$program";
|
|
|
|
}
|
1997-10-28 18:47:27 +00:00
|
|
|
}
|
|
|
|
|
1998-03-09 22:52:38 +00:00
|
|
|
die "Cannot locate program.\n" if ( $path eq "" );
|
|
|
|
|
|
|
|
|
1997-10-28 18:47:27 +00:00
|
|
|
# set the FG_ROOT environment variable if it hasn't already been set.
|
|
|
|
if ( $ENV{FG_ROOT} eq "" ) {
|
|
|
|
# look for a file called fgtop as a place marker
|
|
|
|
if ( -e "fgtop" ) {
|
|
|
|
$ENV{FG_ROOT} = ".";
|
|
|
|
} elsif ( -e "../fgtop" ) {
|
|
|
|
$ENV{FG_ROOT} = "..";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# run Flight Gear
|
1998-02-16 16:17:33 +00:00
|
|
|
print "Running $path @ARGV\n";
|
|
|
|
exec("$path @ARGV");
|
1997-10-28 18:47:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
# $Log$
|
1998-03-09 22:52:38 +00:00
|
|
|
# Revision 1.4 1998/03/09 22:52:38 curt
|
|
|
|
# Mod's to better support win32 if perl exists.
|
|
|
|
#
|
1998-02-16 16:17:33 +00:00
|
|
|
# Revision 1.3 1998/02/16 16:17:34 curt
|
|
|
|
# Minor tweaks.
|
|
|
|
#
|
1998-01-27 00:47:41 +00:00
|
|
|
# Revision 1.2 1998/01/27 00:47:43 curt
|
|
|
|
# Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
|
|
|
|
# system and commandline/config file processing code.
|
|
|
|
#
|
1997-10-28 18:47:27 +00:00
|
|
|
# Revision 1.1 1997/10/28 18:47:27 curt
|
|
|
|
# Initial revision.
|
|
|
|
#
|