+
+std::string File_Tools::path(const std::string& theFileName)
+{
+ OSD_Path aPath (theFileName.c_str());
+ Standard_Integer aTrekLen =
+ int(theFileName.size()) - aPath.Extension().Length() - aPath.Name().Length();
+ return theFileName.substr(0, aTrekLen);
+}
+
+bool AlgoError::isAlgorithmFailed(const GeomMakeShapePtr& theAlgorithm,
+ const std::string& theFeature,
+ std::string& theError)
+{
+ theError.clear();
+ if (!theAlgorithm->isDone()) {
+ theError = "Error: " + (theFeature.empty() ? "The" : theFeature) + " algorithm failed.";
+ std::string anAlgoError = theAlgorithm->getError();
+ if (!anAlgoError.empty())
+ theError += " " + anAlgoError;
+ return true;
+ }
+ if (!theAlgorithm->shape() || theAlgorithm->shape()->isNull()) {
+ theError = "Error: Resulting shape";
+ if (!theFeature.empty())
+ theError += " of " + theFeature;
+ theError += " is Null.";
+ return true;
+ }
+ if (!theAlgorithm->isValid()) {
+ theError = "Error: Resulting shape";
+ if (!theFeature.empty())
+ theError += " of " + theFeature;
+ theError += " is not valid.";
+ return true;
+ }
+ return false;
+}