From 0c6ecd1271c68c06e736053387f25bb0ba0540e8 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sat, 16 Jun 2007 21:35:16 +0000 Subject: [PATCH] set /sim/fg-current to current working directory; getcwd() is defined in unistd.h (which was already included), and should be available in direct.h under name _getcwd on MS Windows. --- src/Main/fg_init.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 08c79ee5c..626f05291 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -37,6 +37,10 @@ #if defined( unix ) || defined( __CYGWIN__ ) # include // for gethostname() #endif +#if defined( _MSC_VER) || defined(__MINGW32__) +# include // 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; }