Ejemplo n.º 1
0
BObjectImp* PolSystemExecutorModule::mf_GetCmdLevelNumber()
{
    const String* cmdlvlname;
    if ( !getStringParam(0, cmdlvlname) )
        return new BError("Invalid parameter type.");

    CmdLevel* cmdlevel_search = find_cmdlevel(cmdlvlname->data());
    if ( cmdlevel_search == NULL )
        return new BError("Could not find a command level with that name.");

    return new BLong(cmdlevel_search->cmdlevel);
}
Ejemplo n.º 2
0
void process_package_cmds_cfg( Plib::Package* pkg )
{
  // ConfigFile cf( (pkg->dir() + "cmds.cfg").c_str(), "Commands" );
  Clib::ConfigFile cf( GetPackageCfgPath( pkg, "cmds.cfg" ).c_str(), "Commands" );
  Clib::ConfigElem elem;
  while ( cf.read( elem ) )
  {
    CmdLevel* cmdlevel = find_cmdlevel( elem.rest() );
    if ( !cmdlevel )
    {
      elem.throw_error( std::string( "Command Level " ) + elem.rest() + " not found." );
    }

    std::string tmp;
    while ( elem.remove_prop( "DIR", &tmp ) )
    {
      Clib::mklower( tmp );
      cmdlevel->add_searchdir_front( pkg, Clib::normalized_dir_form( pkg->dir() + tmp ) );
    }
  }
}