From 4b65d489c2b3ede31e79f7c25a1f2673ed8464c5 Mon Sep 17 00:00:00 2001 From: Alain Klotz Date: Tue, 19 Mar 2019 07:35:25 +0100 Subject: [PATCH] Correction des "/" avec des os.sep pour assurer la compatibilité Windows/Linux. --- src/agent/Agent.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/agent/Agent.py b/src/agent/Agent.py index be52525..d8eb8ac 100755 --- a/src/agent/Agent.py +++ b/src/agent/Agent.py @@ -288,14 +288,14 @@ class Agent: self.set_status(self.STATUS_LAUNCH) self.set_mode(self.MODE_IDLE) if not config_filename: - #config_filename = '/PROJECTS/GFT/SOFT/PYROS_SOFT/CURRENT/config/config_unit_simulunit1.xml' config_filename = self.DEFAULT_CONFIG_FILE_NAME - #config_file_path, _ = os.path.split(config_filename) + + print(f"config_filename={config_filename}") # If config file name is RELATIVE (i.e. without path, just the file name) # => give it an absolute path (and remove "src/agent/" from it) if config_filename == os.path.basename(config_filename): - #config_filename = os.path.abspath(self.CONFIG_DIR + os.sep + config_filename).replace("src/agent/","") - config_filename = os.path.abspath(self.CONFIG_DIR + os.sep + config_filename).replace("/src/","/").replace("/agent/","/") + tmp = os.path.abspath(self.CONFIG_DIR + os.sep + config_filename) + config_filename = os.path.abspath(self.CONFIG_DIR + os.sep + config_filename).replace(os.sep+"src"+os.sep,os.sep).replace(os.sep+"agent"+os.sep,os.sep) print("Config file used is", config_filename) #print("current path", os.getcwd()) #print("this file path :", __file__) -- libgit2 0.21.2