return naStr_fromdata(naNewString(c), const_cast<char*>(pdata), strlen(pdata));
}
+static naRef f_findDataDir(naContext c, naRef me, int argc, naRef* args)
+{
+ if(argc != 1 || !naIsString(args[0]))
+ naRuntimeError(c, "bad arguments to findDataDir()");
+
+ SGPath p = globals->find_data_dir(naStr_data(args[0]));
+ const char* pdata = p.c_str();
+ return naStr_fromdata(naNewString(c), const_cast<char*>(pdata), strlen(pdata));
+}
+
class NasalCommand : public SGCommandMgr::Command
{
public:
{ "abort", f_abort },
{ "directory", f_directory },
{ "resolvepath", f_resolveDataPath },
+ { "finddata", f_findDataDir },
{ "parsexml", f_parsexml },
{ "systime", f_systime },
{ 0, 0 }
// Create module with list of scripts
void FGNasalSys::addModule(string moduleName, simgear::PathList scripts)
{
- if (scripts.size()>0)
+ if (! scripts.empty())
{
SGPropertyNode* nasal = globals->get_props()->getNode("nasal");
SGPropertyNode* module_node = nasal->getChild(moduleName,0,true);
void FGNasalListener::call(SGPropertyNode* which, naRef mode)
{
if(_active || _dead) return;
- SG_LOG(SG_NASAL, SG_DEBUG, "trigger listener #" << _id);
_active++;
naRef arg[4];
arg[0] = _nas->propNodeGhost(which);