]> git.mxchange.org Git - flightgear.git/commitdiff
Updated to be smarter about finding $FG_ROOT.
authorcurt <curt>
Mon, 3 Aug 1998 22:16:42 +0000 (22:16 +0000)
committercurt <curt>
Mon, 3 Aug 1998 22:16:42 +0000 (22:16 +0000)
Main/runfg.in

index c7e8c07dd99ce37b9d92d1f9e9239e5b62408058..24f4b9782a005e2ee6e798ce7c81253fc87ddfe0 100755 (executable)
@@ -32,10 +32,10 @@ $prefix = "@prefix@";
 # potential names of Flight Gear executable to try
 @files = ( "fg", "fg.exe" );
 
+# search for the executable
 # potential paths where the executable may be found
 @paths = ( ".", "Simulator/Main", $prefix );
 
-# search for the executable
 $savepath = "";
 $savefile = "";
 
@@ -46,9 +46,11 @@ foreach $path (@paths) {
            # don't search again if we've already found one
            # print "checking $path" . "bin/$file and $path" . "$file\n";
            if ( -x "$path/bin/$file" ) {
+               $saveprefix = $path;
                $savepath = "$path/bin";
                $savefile = "$file";
            } elsif ( -x "$path/$file" ) {
+               $saveprefix = $path;
                $savepath = "$path";
                $savefile = "$file";
            }
@@ -61,31 +63,35 @@ foreach $path (@paths) {
 die "Cannot locate program.\n" if ( $savepath eq "" );
 
 
-# set the FG_ROOT environment variable if it hasn't already been set.
-if ( $ENV{FG_ROOT} eq "" ) {
-    $ENV{FG_ROOT} = $prefix;
-}
+# search for the "FlightGear" root directory
+@paths = ( $saveprefix, $ENV{HOME} );
 
-# set the LD_LIBRARY_PATH environment variable if running the
-# installed version
-if ( $savepath eq "@prefix@/bin" ) {
-    print "(installed version)\n";
-    if ( $ENV{LD_LIBRARY_PATH} eq "" ) {
-       $ENV{LD_LIBRARY_PATH} = "$prefix/lib";
-    } else {
-       $ENV{LD_LIBRARY_PATH} = "$prefix/lib:$ENV{LD_LIBRARY_PATH}";
+$fg_root = "";
+
+foreach $path (@paths) {
+    # print "trying $path\n";
+
+    if ( $fg_root eq "" ) {
+       if ( -d "$path/FlightGear" ) {
+           $fg_root = "$path/FlightGear";
+       } elsif ( -d "$path/lib/FlightGear" ) {
+           $fg_root = "$path/lib/FlightGear";
+       }
     }
-} else {
-    print "(development version)\n";
 }
 
+die "Cannot locate FG root directory (data)\n" if ( $fg_root eq "" );
+
 # run Flight Gear
-print "Running $savepath/$savefile @ARGV\n";
-exec("$savepath/$savefile @ARGV");
+print "Running $savepath/$savefile --fg-root=$fg_root @ARGV\n";
+exec("$savepath/$savefile --fg-root=$fg_root @ARGV");
 
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.3  1998/08/03 22:16:42  curt
+# Updated to be smarter about finding $FG_ROOT.
+#
 # Revision 1.2  1998/04/25 22:06:31  curt
 # Edited cvs log messages in source files ... bad bad bad!
 #