1
0
Fork 0

- make sure /sim/fg-current can't get preset and write protected, so

it's reliable at Nasal init time.
- make sure the cwd buffer is terminated
This commit is contained in:
mfranz 2008-06-22 11:29:32 +00:00
parent b21cf2a22d
commit 889f3926f2

View file

@ -1404,8 +1404,13 @@ bool fgInitGeneral() {
}
#endif
char buf[512], *cwd = getcwd(buf, 512);
fgSetString("/sim/fg-current", cwd ? cwd : "");
char buf[512], *cwd = getcwd(buf, 511);
buf[511] = '\0';
SGPropertyNode *curr = fgGetNode("/sim", true);
curr->removeChild("fg-current", 0, false);
curr = curr->getChild("fg-current", 0, true);
curr->setStringValue(cwd ? cwd : "");
curr->setAttribute(SGPropertyNode::WRITE, false);
return true;
}