- 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:
parent
b21cf2a22d
commit
889f3926f2
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue