From ab879407c5bd016ebe5e74c59dc068fe6c1f0d44 Mon Sep 17 00:00:00 2001 From: Tonny Tzeng Date: Mon, 23 Mar 2020 19:57:58 +0800 Subject: [PATCH] acrn-config: create temporary scenario file folder if it doesn't exist This commit creates the folder for hosting the temporary scenario .xml files if the folder doesn't exist to avoid the FileNotFound python exception. Tracked-On: #4522 Signed-off-by: Tonny Tzeng --- misc/acrn-config/config_app/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/misc/acrn-config/config_app/views.py b/misc/acrn-config/config_app/views.py index cf91fab43..f48113548 100644 --- a/misc/acrn-config/config_app/views.py +++ b/misc/acrn-config/config_app/views.py @@ -527,6 +527,9 @@ def upload_scenario(): tmp_scenario_name = 'tmp_' + scenario_file_name + '.xml' tmp_scenario_file = os.path.join(current_app.config.get('CONFIG_PATH'), board_type, 'user_defined', tmp_scenario_name) + tmp_scenario_folder = os.path.dirname(tmp_scenario_file) + if not os.path.exists(tmp_scenario_folder): + os.makedirs(tmp_scenario_folder) if os.path.isfile(tmp_scenario_file): os.remove(tmp_scenario_file)