launcher:scenario: Fix the way we compute scenario path/name when paths supplied

We were just iterating over the list without any check and could end
up with a patch that was not corresponding to the actual scenario.
This commit is contained in:
Thibault Saunier 2018-09-08 11:12:32 -03:00
parent 1623f7111c
commit 64afff0c3e

View file

@ -1950,15 +1950,16 @@ class ScenarioManager(Loggable):
for section in config.sections(): for section in config.sections():
if scenario_paths: if scenario_paths:
for scenario_path in scenario_paths: for scenario_path in scenario_paths:
if mfile is None: if section in os.path.splitext(os.path.basename(scenario_path))[0]:
name = section if mfile is None:
path = scenario_path name = section
elif section in scenario_path: path = scenario_path
# The real name of the scenario is: else:
# filename.REALNAME.scenario # The real name of the scenario is:
name = scenario_path.replace(mfile + ".", "").replace( # filename.REALNAME.scenario
"." + self.FILE_EXTENSION, "") name = scenario_path.replace(mfile + ".", "").replace(
path = scenario_path "." + self.FILE_EXTENSION, "")
path = scenario_path
else: else:
name = section name = section
path = None path = None