3 # runfg -- front end for setting up the FG_ROOT env variable and launching
6 # Written by Curtis Olson, started September 1997.
8 # Copyright (C) 1997 - 1998 Curtis L. Olson - curt@me.umn.edu
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 # (Log is kept at end of this file)
26 #---------------------------------------------------------------------------
30 # print "-> $prefix\n";
32 # potential names of Flight Gear executable to try
33 @files = ( "fg", "fg.exe" );
35 # search for the executable
36 # potential paths where the executable may be found
37 @paths = ( ".", "Simulator/Main", $prefix );
42 foreach $path (@paths) {
43 foreach $file (@files) {
44 # print "'$savepath'\n";
45 if ( $savepath eq "" ) {
46 # don't search again if we've already found one
47 # print "checking $path" . "bin/$file and $path" . "$file\n";
48 if ( -x "$path/bin/$file" ) {
50 $savepath = "$path/bin";
52 } elsif ( -x "$path/$file" ) {
58 # print "skipping $path/bin/$file and $path/$file\n";
63 die "Cannot locate program.\n" if ( $savepath eq "" );
66 # search for the "FlightGear" root directory
67 @paths = ( $prefix, $saveprefix, $ENV{HOME} );
71 foreach $path (@paths) {
72 # print "trying $path\n";
74 if ( $fg_root eq "" ) {
75 if ( -d "$path/FlightGear" ) {
76 $fg_root = "$path/FlightGear";
77 } elsif ( -d "$path/lib/FlightGear" ) {
78 $fg_root = "$path/lib/FlightGear";
83 die "Cannot locate FG root directory (data)\n" if ( $fg_root eq "" );
86 print "Running $savepath/$savefile --fg-root=$fg_root @ARGV\n";
87 exec("$savepath/$savefile --fg-root=$fg_root @ARGV");
90 #---------------------------------------------------------------------------
92 # Revision 1.2 1998/08/25 16:59:10 curt
93 # Directory reshuffling.
95 # Revision 1.1 1998/08/24 20:32:41 curt
96 # runfg.in renamed to runfgfs.in
98 # Revision 1.3 1998/08/03 22:16:42 curt
99 # Updated to be smarter about finding $FG_ROOT.
101 # Revision 1.2 1998/04/25 22:06:31 curt
102 # Edited cvs log messages in source files ... bad bad bad!
104 # Revision 1.1 1998/04/09 01:45:31 curt
105 # Moved to Main/ and incorperated with automake
107 # Revision 1.4 1998/03/09 22:52:38 curt
108 # Mod's to better support win32 if perl exists.
110 # Revision 1.3 1998/02/16 16:17:34 curt
113 # Revision 1.2 1998/01/27 00:47:43 curt
114 # Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
115 # system and commandline/config file processing code.
117 # Revision 1.1 1997/10/28 18:47:27 curt