]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
set /sim/fg-current to current working directory; getcwd() is defined in
[flightgear.git] / src / Main / fg_init.cxx
index 08c79ee5c8c7f89607ec3ac7ed523297a4097532..626f05291cba152a68244a4728efec445c2db771 100644 (file)
 #if defined( unix ) || defined( __CYGWIN__ )
 #  include <unistd.h>           // for gethostname()
 #endif
+#if defined( _MSC_VER) || defined(__MINGW32__)
+#  include <direct.h>           // for getcwd()
+#  define getcwd _getcwd
+#endif
 
 // work around a stdc++ lib bug in some versions of linux, but doesn't
 // seem to hurt to have this here for all versions of Linux.
@@ -1309,6 +1313,8 @@ bool fgInitGeneral() {
     }
 #endif
 
+    char buf[256], *cwd = getcwd(buf, 256);
+    fgSetString("/sim/fg-current", cwd ? cwd : "");
     return true;
 }