From 3b5ace3707effcfd8fdbfd4e8fbc3d95da5bfb68 Mon Sep 17 00:00:00 2001 From: Nobuhiko Miyamoto Date: Wed, 19 Jan 2022 18:06:54 +0900 Subject: [PATCH] [compat] replace environment value in config file. --- OpenRTM_aist/ModuleManager.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OpenRTM_aist/ModuleManager.py b/OpenRTM_aist/ModuleManager.py index 76b42afe..0c1c226a 100644 --- a/OpenRTM_aist/ModuleManager.py +++ b/OpenRTM_aist/ModuleManager.py @@ -257,21 +257,26 @@ def load(self, file_name, init_func=None): pathChanged = False file_path = None - if OpenRTM_aist.isAbsolutePath(file_name): + name = OpenRTM_aist.replaceEnv(file_name) + if OpenRTM_aist.isAbsolutePath(name): if not self._absoluteAllowed: raise ModuleManager.NotAllowedOperation( "Absolute path is not allowed") else: - splitted_name = os.path.split(file_name) + splitted_name = os.path.split(name) save_path = sys.path[:] sys.path.append(splitted_name[0]) pathChanged = True import_name = splitted_name[-1] - file_path = file_name + file_path = name else: - file_path = self.findFile(file_name, self._loadPath) + paths = [] + for path in self._loadPath: + paths.append(OpenRTM_aist.replaceEnv(path)) + file_path = self.findFile(name, paths) + if not file_path: raise ModuleManager.FileNotFound(file_name) @@ -555,6 +560,7 @@ def getModuleList(self, lang, modules): continue self._rtcout.RTC_DEBUG("Module load path: %s", path) flist = [] + path = OpenRTM_aist.replaceEnv(path) for suffix in suffixes: suffix = OpenRTM_aist.eraseHeadBlank(suffix)