From 3986347f377977ec8bf9caff93baac63b22f03b6 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sun, 18 Dec 2005 09:35:01 +0000 Subject: [PATCH] MSVC fix. --- src/Main/fg_commands.cxx | 8 ++++++++ src/Main/fg_init.cxx | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index a23b5355e..f2189ad57 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -191,11 +191,19 @@ do_exit (const SGPropertyNode * arg) { SG_LOG(SG_INPUT, SG_INFO, "Program exit requested."); +#ifdef _MSC_VER + char* envp = ::getenv( "APPDATA" ); +#else char* envp = ::getenv( "HOME" ); +#endif if ( envp != NULL ) { SGPath config( globals->get_fg_root() ); config.set( envp ); +#ifdef _MSC_VER + config.append( "flightgear.org" ); +#else config.append( ".fgfs" ); +#endif config.append( "preferences.xml" ); config.create_dir( 0700 ); SG_LOG(SG_IO, SG_INFO, "Saving user preferences"); diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index e1bb2e565..9cd7bab38 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -607,12 +607,19 @@ bool fgInitConfig ( int argc, char **argv ) { SG_LOG( SG_INPUT, SG_ALERT, "No default aircraft specified" ); } - +#ifdef _MSC_VER + char* envp = ::getenv( "APPDATA" ); +#else char* envp = ::getenv( "HOME" ); +#endif if ( envp != NULL ) { SGPath config( globals->get_fg_root() ); config.set( envp ); +#ifdef _MSC_VER + config.append( "flightgear.org" ); +#else config.append( ".fgfs" ); +#endif config.append( "preferences.xml" ); SG_LOG(SG_INPUT, SG_INFO, "Reading user preferences"); fgLoadProps(config.str().c_str(), globals->get_props(), false, SGPropertyNode::USERARCHIVE);