1
0
Fork 0

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.
This commit is contained in:
mfranz 2007-06-16 21:35:16 +00:00
parent 58e0deb56b
commit 0c6ecd1271

View file

@ -37,6 +37,10 @@
#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;
}