1
0
Fork 0

Remove platform-specific code in favour of simgear::Dir wrappers.

This commit is contained in:
James Turner 2012-05-31 08:57:22 +01:00
parent 00f580925b
commit 17ec3278ed

View file

@ -29,15 +29,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> // strcmp() #include <string.h> // strcmp()
#if defined( unix ) || defined( __CYGWIN__ )
# include <unistd.h> // for gethostname()
#endif
#ifdef _WIN32 #ifdef _WIN32
# include <direct.h> // for getcwd()
# define getcwd _getcwd
# include <io.h> // isatty() # include <io.h> // isatty()
# define isatty _isatty # define isatty _isatty
# include "winsock2.h" // for gethostname()
#endif #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
@ -1027,12 +1021,11 @@ bool fgInitGeneral() {
globals->set_browser(fgGetString("/sim/startup/browser-app", "firefox %u")); globals->set_browser(fgGetString("/sim/startup/browser-app", "firefox %u"));
char buf[512], *cwd = getcwd(buf, 511); simgear::Dir cwd(simgear::Dir::current());
buf[511] = '\0';
SGPropertyNode *curr = fgGetNode("/sim", true); SGPropertyNode *curr = fgGetNode("/sim", true);
curr->removeChild("fg-current", 0, false); curr->removeChild("fg-current", 0, false);
curr = curr->getChild("fg-current", 0, true); curr = curr->getChild("fg-current", 0, true);
curr->setStringValue(cwd ? cwd : ""); curr->setStringValue(cwd.path().str());
curr->setAttribute(SGPropertyNode::WRITE, false); curr->setAttribute(SGPropertyNode::WRITE, false);
fgSetBool("/sim/startup/stdout-to-terminal", isatty(1) != 0 ); fgSetBool("/sim/startup/stdout-to-terminal", isatty(1) != 0 );