From 5cb1444b1dfc05566e821ab1c19115d8b6b53a23 Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Tue, 1 Feb 2022 21:27:03 -0300 Subject: [PATCH] Tools: use path relative to current directory to load parameters --- Tools/autotest/pysim/util.py | 3 +++ Tools/autotest/sim_vehicle.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/autotest/pysim/util.py b/Tools/autotest/pysim/util.py index 517edf1c34..10310443eb 100644 --- a/Tools/autotest/pysim/util.py +++ b/Tools/autotest/pysim/util.py @@ -57,6 +57,9 @@ def topdir(): d = os.path.dirname(d) return d +def relcurdir(path): + """Return a path relative to current dir""" + return os.path.relpath(path, os.getcwd()) def reltopdir(path): """Return a path relative to topdir().""" diff --git a/Tools/autotest/sim_vehicle.py b/Tools/autotest/sim_vehicle.py index 256b6ebeda..dd6020ebcc 100755 --- a/Tools/autotest/sim_vehicle.py +++ b/Tools/autotest/sim_vehicle.py @@ -684,7 +684,7 @@ def start_vehicle(binary, opts, stuff, spawns=None): paths = stuff["default_params_filename"] if not isinstance(paths, list): paths = [paths] - paths = [util.reltopdir(os.path.join(autotest_dir, x)) for x in paths] + paths = [util.relcurdir(os.path.join(autotest_dir, x)) for x in paths] for x in paths: if not os.path.isfile(x): print("The parameter file (%s) does not exist" % (x,))