From 18bf943f27f67423ca76b08e8ac172c2804678b8 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Thu, 12 Oct 2023 14:23:10 +0000 Subject: [PATCH] Allow factory to read from multiple locations Signed-off-by: Michael Carroll --- core/src/DynamicFactory.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/DynamicFactory.cc b/core/src/DynamicFactory.cc index a8a7dac3..b46ad039 100644 --- a/core/src/DynamicFactory.cc +++ b/core/src/DynamicFactory.cc @@ -65,11 +65,15 @@ DynamicFactory::DynamicFactory() // Load all the descriptors found in the paths set with GZ_DESCRIPTOR_PATH. this->LoadDescriptors(descPaths); } - else + + auto globalPath = + std::filesystem::path(gz::msgs::getInstallPrefix()) / + "share" / "gz" / "protos"; + + if (std::filesystem::exists(globalPath)) { // Load descriptors from the global share path - this->LoadDescriptors((std::filesystem::path( - gz::msgs::getInstallPrefix()) / "share" / "gz" / "protos").string()); + this->LoadDescriptors(globalPath.string()); } }