Salome HOME
bos #26449: SHAPER: save imported images
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Tools.cpp
index 55e1e6df9c6fbffb88afd952012172ca61b4781a..a26b7257e92247735e7670f0e277fb5195d0dabd 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -61,6 +61,14 @@ std::string File_Tools::name(const std::string& theFileName)
   return aPath.Name().ToCString();
 }
 
+std::string File_Tools::path(const std::string& theFileName)
+{
+  OSD_Path aPath (theFileName.c_str());
+  Standard_Integer aTrekLen =
+    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)
@@ -76,14 +84,14 @@ bool AlgoError::isAlgorithmFailed(const GeomMakeShapePtr& theAlgorithm,
   if (!theAlgorithm->shape() || theAlgorithm->shape()->isNull()) {
     theError = "Error: Resulting shape";
     if (!theFeature.empty())
-      theError += "of " + theFeature;
+      theError += " of " + theFeature;
     theError += " is Null.";
     return true;
   }
   if (!theAlgorithm->isValid()) {
     theError = "Error: Resulting shape";
     if (!theFeature.empty())
-      theError += "of " + theFeature;
+      theError += " of " + theFeature;
     theError += " is not valid.";
     return true;
   }