void MOOSAppDocumentation::showExampleConfigAndExit() { showTitleSection("EXAMPLE MOOS CONFIGURATION"); string repository_path = getRepositoryPath(); string example_path = repository_path + "/src/app/" + m_moosapp_name + "/" + m_moosapp_name + ".moos"; // Test file existance with ifstream ifstream moosfile(example_path.c_str()); if(!moosfile || !moosfile.is_open()) { red(" ERROR: unable to load " + m_moosapp_name + ".moos example file."); blk(" Please check file existance at:"); blk(" " + example_path + "\n"); exit(0); } // Write .moos configuration file string line; while(getline(moosfile, line)) blk(line); blk(""); moosfile.close(); exit(0); }
void MOOSAppDocumentation::loadXML() { string repository_path = getRepositoryPath(); string doc_path = repository_path + "/src/app/" + m_moosapp_name + "/" + m_moosapp_name + ".xml"; // Test file existance with ifstream ifstream xmlfile(doc_path.c_str()); if(!xmlfile) { red(" ERROR: unable to load " + m_moosapp_name + ".xml documentation file."); blk(" Please check file existance at:"); blk(" " + doc_path + "\n"); exit(0); } // Test XML validity string item_error = ""; m_xml_doc = new XMLDocument(); if(m_xml_doc->LoadFile(doc_path.c_str()) != XML_NO_ERROR || !parseXML(item_error)) { red(" ERROR: unable to load " + m_moosapp_name + ".xml documentation file."); if(item_error != "") blk(" Unable to read <" + item_error + ">"); blk(" Please check XML validity at:"); blk(" " + doc_path + "\n"); exit(0); } }