From e45512cdb6ae8eaa3fbd203a3a534ea195d39ba6 Mon Sep 17 00:00:00 2001
From: Christoph Pohl <christoph.pohl@kit.edu>
Date: Tue, 8 Aug 2023 10:08:45 +0200
Subject: [PATCH] Fix `armarx gui` trying to start the old memory if `MemoryX`
 is not in the workspace

Signed-off-by: ARMAR-DE <>
---
 .../applications/ArmarXGui/ArmarXGuiApp.cpp   | 32 +++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.cpp b/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.cpp
index 22c7dfcc..75cf83b3 100644
--- a/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.cpp
+++ b/source/ArmarXGui/applications/ArmarXGui/ArmarXGuiApp.cpp
@@ -174,12 +174,13 @@ namespace armarx
 
     int ArmarXGuiApp::startArmarX()
     {
-        CMakePackageFinder finder("ArmarXCore");
+        CMakePackageFinder armarx_core("ArmarXCore");
+        CMakePackageFinder armarx_memoryx("MemoryX");
 
         int res;
-        if (finder.packageFound())
+        if (armarx_core.packageFound())
         {
-            res = system(std::string(finder.getBinaryDir() + std::string("/armarx start")).c_str());
+            res = system(std::string(armarx_core.getBinaryDir() + std::string("/armarx start")).c_str());
         }
         else
         {
@@ -189,19 +190,18 @@ namespace armarx
         if (res == EXIT_SUCCESS)
         {
             ARMARX_INFO_S << "Started ArmarX successfully!";
-            if (finder.packageFound())
-            {
-                res = system(std::string(finder.getBinaryDir() + std::string("/armarx memory start")).c_str());
-            }
-            else
-            {
-                res = system("armarx memory assureRunning");
-            }
-            res = WEXITSTATUS(res);
-            if (res == EXIT_FAILURE)
-            {
-                QMessageBox::warning(nullptr, "ArmarX Error", "Could not start MongoDB! See terminal output for more information. The GUI will now started anyway.");
-                return 0;
+            if (armarx_memoryx.packageFound()) {
+                if (armarx_core.packageFound()) {
+                    res = system(std::string(armarx_core.getBinaryDir() + std::string("/armarx memory start")).c_str());
+                } else {
+                    res = system("armarx memory assureRunning");
+                }
+                res = WEXITSTATUS(res);
+                if (res == EXIT_FAILURE) {
+                    QMessageBox::warning(nullptr, "ArmarX Error",
+                                         "Could not start MongoDB! See terminal output for more information. The GUI will now started anyway.");
+                    return 0;
+                }
             }
         }
         else
-- 
GitLab