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:
parent
58e0deb56b
commit
0c6ecd1271
1 changed files with 6 additions and 0 deletions
|
@ -37,6 +37,10 @@
|
||||||
#if defined( unix ) || defined( __CYGWIN__ )
|
#if defined( unix ) || defined( __CYGWIN__ )
|
||||||
# include <unistd.h> // for gethostname()
|
# include <unistd.h> // for gethostname()
|
||||||
#endif
|
#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
|
// 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.
|
// seem to hurt to have this here for all versions of Linux.
|
||||||
|
@ -1309,6 +1313,8 @@ bool fgInitGeneral() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char buf[256], *cwd = getcwd(buf, 256);
|
||||||
|
fgSetString("/sim/fg-current", cwd ? cwd : "");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue