From 30cb13e8be3d09f288309d8eec27a821d88997c4 Mon Sep 17 00:00:00 2001
From: Fabian Reister <fabian.reister@kit.edu>
Date: Mon, 17 Jul 2023 13:39:15 +0200
Subject: [PATCH] ObjectFinder: setLogObjectDiscoveryError

---
 source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.cpp | 8 +++++++-
 source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.h   | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.cpp b/source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.cpp
index f5516353e..8b61c578c 100644
--- a/source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.cpp
+++ b/source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.cpp
@@ -220,6 +220,8 @@ namespace armarx
             if (fs::is_directory(datasetDir / dir))
             {
                 ObjectInfo object(packageName, absPackageDataDir, relObjectsDir, dataset, dir.filename());
+                object.setLogError(logObjectDiscoveryError);
+                
                 if (!checkPaths || object.checkPaths())
                 {
                     objects.push_back(object);
@@ -371,6 +373,11 @@ namespace armarx
             return info.loadSpokenNames();
         });
     }
+    
+    void ObjectFinder::setLogObjectDiscoveryError(bool logEnabled) 
+    {
+        logObjectDiscoveryError = logEnabled;
+    }
 
     ObjectFinder::path ObjectFinder::_rootDirAbs() const
     {
@@ -388,4 +395,3 @@ namespace armarx
     }
 
 }
-
diff --git a/source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.h b/source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.h
index 708608528..5c461033d 100644
--- a/source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.h
+++ b/source/RobotAPI/libraries/ArmarXObjects/ObjectFinder.h
@@ -94,6 +94,8 @@ namespace armarx
          */
         std::vector<std::string> loadSpokenNames(const ObjectID& objectID, bool includeClassName = false) const;
 
+        void setLogObjectDiscoveryError(bool logEnabled);
+
 
     private:
 
@@ -120,5 +122,9 @@ namespace armarx
         /// Path to the directory containing objects in the package's data directory.
         path relObjectsDir;
 
+
+        // see: ObjectInfo::checkPaths()
+        bool logObjectDiscoveryError = true;
+
     };
 }
-- 
GitLab