From 570ae1ebc857d27e73210e034fef0082df17dc29 Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Fri, 3 Jun 2016 09:29:06 +0800 Subject: [PATCH] BaseTools: Add error handling for current_dir is not exist Add the error handling to cover the case that current_dir is not exist. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/Python/AutoGen/GenMake.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 475b794fe8..4b2902f473 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -597,10 +597,11 @@ cleanlib: while not found and os.sep in package_rel_dir: index = package_rel_dir.index(os.sep) current_dir = mws.join(current_dir, package_rel_dir[:index]) - for fl in os.listdir(current_dir): - if fl.endswith('.dec'): - found = True - break + if os.path.exists(current_dir): + for fl in os.listdir(current_dir): + if fl.endswith('.dec'): + found = True + break package_rel_dir = package_rel_dir[index + 1:] MakefileTemplateDict = { -- 2.39.2