]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
make isatty() available for stdout/stderr (hope it works on MS Windows)
[flightgear.git] / src / Main / fg_init.cxx
index 26a9425028d2dde692d95037856787739b750880..9e21c719f1920c5781a0cfdbc2bace13156bcb5c 100644 (file)
@@ -35,6 +35,8 @@
 #if defined( _MSC_VER) || defined(__MINGW32__)
 #  include <direct.h>           // for getcwd()
 #  define getcwd _getcwd
+#  include <io.h>               // isatty()
+#  define isatty _isatty
 #endif
 
 // work around a stdc++ lib bug in some versions of linux, but doesn't
@@ -581,7 +583,7 @@ bool fgInitConfig ( int argc, char **argv ) {
     }
 
     SGPropertyNode autosave;
-#ifdef _MSC_VER
+#if defined( _MSC_VER ) || defined( __MINGW32__ )
     char *envp = ::getenv( "APPDATA" );
     if (envp != NULL ) {
         SGPath config( envp );
@@ -1186,6 +1188,9 @@ bool fgInitGeneral() {
     curr = curr->getChild("fg-current", 0, true);
     curr->setStringValue(cwd ? cwd : "");
     curr->setAttribute(SGPropertyNode::WRITE, false);
+
+    fgSetBool("/sim/startup/stdout-to-terminal", isatty(1));
+    fgSetBool("/sim/startup/stderr-to-terminal", isatty(2));
     return true;
 }