1 // main.cxx -- FlightGear Scenery/Aircraft Admin Tool
3 // Written by Curtis Olson, started February 2004.
5 // Copyright (c) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include <FL/filename.H>
28 std::string def_install_source;
29 std::string def_scenery_dest;
34 * --install-source=<DIR>
35 * --scenery-dest=<DIR>
38 parse_args( int, char** argv, int& i )
40 if (strcmp( argv[i], "--silent" ) == 0)
46 else if (strncmp( argv[i], "--install-source=", 17 ) == 0)
48 def_install_source.assign( &argv[i][17] );
52 else if (strncmp( argv[i], "--scenery-dest=", 15 ) == 0)
54 def_scenery_dest.assign( &argv[i][15] );
63 main( int argc, char* argv[] )
66 if (Fl::args( argc, argv, i, parse_args ) < argc)
68 Fl::fatal("Options are:\n --silent\n --install-source=<DIR>\n --scenery-dest=<DIR>\n%s", Fl::help );
73 Fl_Preferences prefs( Fl_Preferences::USER, "flightgear.org", "fgadmin" );
74 char abs_name[ FL_PATH_MAX ];
76 fl_filename_absolute( abs_name, def_install_source.c_str() );
77 prefs.set( "install-source", abs_name );
79 fl_filename_absolute( abs_name, def_scenery_dest.c_str() );
80 prefs.set( "scenery-dest", abs_name );