diff --git a/VirtualRobot/XML/BaseIO.cpp b/VirtualRobot/XML/BaseIO.cpp index 2358a1614a83fa3a475a10c5bc401dd4628d255c..261fb843eb148db22d850b3b25cb507d0e66092d 100644 --- a/VirtualRobot/XML/BaseIO.cpp +++ b/VirtualRobot/XML/BaseIO.cpp @@ -961,14 +961,18 @@ std::string BaseIO::processFileNode( rapidxml::xml_node<char> *fileNode, const s // check file absolute boost::filesystem::path fn(fileName); - if (boost::filesystem::exists(fn)) - return fileName; + try { + if (boost::filesystem::exists(fn)) + return fileName; + } catch (...){} // check file relative std::string absFileName = fileName; makeAbsolutePath(basePath,absFileName); fn = absFileName; + try { if (boost::filesystem::exists(fn)) return absFileName; + } catch (...){} // check file in data paths absFileName = fileName; if (RuntimeEnvironment::getDataFileAbsolute(absFileName)) @@ -1198,8 +1202,10 @@ TrajectoryPtr BaseIO::processTrajectory(rapidxml::xml_node<char> *trajectoryXMLN bool BaseIO::writeXMLFile(const std::string &filename, const std::string &content, bool overwrite) { + try { if (!overwrite && boost::filesystem::exists(filename)) return false; + } catch (...){} // save file std::ofstream out(filename.c_str(),std::ios::out|std::ios::trunc); diff --git a/VirtualRobot/XML/RobotIO.cpp b/VirtualRobot/XML/RobotIO.cpp index a80fa85c329fe9f0a1ae471f3eeacfe33d2bdf44..d78fb64f81478affab3f87a23404cd9f5dbedffb 100644 --- a/VirtualRobot/XML/RobotIO.cpp +++ b/VirtualRobot/XML/RobotIO.cpp @@ -583,8 +583,12 @@ RobotPtr RobotIO::processRobot(rapidxml::xml_node<char>* robotXMLNode, const std boost::filesystem::path filenameNewComplete = boost::filesystem::operator/(filenameBasePath,filenameNew); VR_INFO << "Searching robot: " << filenameNewComplete.string() << endl; - - THROW_VR_EXCEPTION_IF(!boost::filesystem::exists(filenameNewComplete), "File <" << filenameNewComplete.string() << "> does not exist." << endl); + try { + THROW_VR_EXCEPTION_IF(!boost::filesystem::exists(filenameNewComplete), "File <" << filenameNewComplete.string() << "> does not exist." << endl); + } catch (...) + { + THROW_VR_EXCEPTION("Error while processing file <" << filenameNewComplete.string() << ">." << endl); + } RobotPtr r = loadRobot(filenameNewComplete.string(),loadMode); THROW_VR_EXCEPTION_IF(!r, "Could not add child-from-robot due to failed loading of robot from file" << childrenFromRobot[i].filename); RobotNodePtr root = r->getRootNode();