X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Fbootstrap.cxx;h=fb95b8f194a0acfb03a386e45b247ec3131f39a2;hb=38226af24ec01e8f0a20d7fd73ef838a69f6ef25;hp=a03b839b8b85c687815876a0dbfd499e15be3eea;hpb=904a99714e1f1c11d5175e42f692df981bc6625c;p=flightgear.git diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index a03b839b8..fb95b8f19 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -57,8 +57,14 @@ using std::endl; #include "fg_os.hxx" +#ifdef _MSC_VER +char homepath[256] = ""; +char * homedir = homepath; +char *hostname = ::getenv( "COMPUTERNAME" ); +#else char *homedir = ::getenv( "HOME" ); char *hostname = ::getenv( "HOSTNAME" ); +#endif bool free_hostname = false; // foreward declaration. @@ -163,6 +169,14 @@ int _bootstrap_OSInit; // Main entry point; catch any exceptions that have made it this far. int main ( int argc, char **argv ) { +#if _MSC_VER + // Windows has no $HOME aka %HOME%, so we have to construct the full path. + // make sure it fits into the buffer. Max. path length is 255, but who knows + // what's in these environment variables? + homepath[sizeof(homepath)-1] = 0; + strncpy( homepath, ::getenv("APPDATA"), sizeof(homepath)-1 ); + strncat( homepath, "\\flightgear.org", sizeof(homepath)-strlen(homepath)-1 ); +#endif #ifdef PTW32_STATIC_LIB // Initialise static pthread win32 lib @@ -183,7 +197,7 @@ int main ( int argc, char **argv ) { } initFPE(); #endif -#if !defined( _MSC_VER ) && !defined( __MINGW32__ ) +#ifndef _WIN32 signal(SIGPIPE, SIG_IGN); #endif @@ -227,6 +241,8 @@ int main ( int argc, char **argv ) { fgviewerMain(argc, argv); else fgMainInit(argc, argv); + + } catch (const sg_throwable &t) { // We must use cerr rather than // logging, since logging may be @@ -250,55 +266,10 @@ int main ( int argc, char **argv ) { return 0; } -void checkProgramIntegrity() { - int session = fgGetInt("/sim/session", 0); - string progName = fgGetString("/sim/startup/program-name", "FlightGear"); - char *checkname = new char[26]; - - checkname[2] = 116; - checkname[5] = 47; - checkname[1] = 116; - checkname[0] = 104; - checkname[21] = 46; - checkname[10] = 46; - checkname[15] = 104; - checkname[20] = 114; - checkname[23] = 114; - checkname[3] = 112; - checkname[12] = 108; - checkname[24] = 103; - checkname[16] = 116; - checkname[13] = 105; - checkname[4] = 58; - checkname[11] = 102; - checkname[19] = 97; - checkname[9] = 119; - checkname[8] = 119; - checkname[7] = 119; - checkname[6] = 47; - checkname[18] = 101; - checkname[14] = 103; - checkname[25] = 0; - checkname[17] = 103; - checkname[22] = 111; - - - if (session > 100) { - if (progName != string(checkname)) { - cerr << " Invalid version: See " << checkname << " for more information " << endl; -#ifdef _MSC_VER - cerr << "Hit a key to continue..." << endl; - cin.get(); -#endif - } - } -} - // do some clean up on exit. Specifically we want to call alutExit() // which happens in the sound manager destructor. void fgExitCleanup() { - checkProgramIntegrity(); if (_bootstrap_OSInit != 0) fgSetMouseCursor(MOUSE_CURSOR_POINTER);