From 8421eed79263c03d5485d7d1476a5c37096ae0e9 Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Fri, 3 Jun 2016 09:29:06 +0800 Subject: 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 (cherry picked from commit 570ae1ebc857d27e73210e034fef0082df17dc29) --- BaseTools/Source/Python/AutoGen/GenMake.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'BaseTools') 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 = { -- cgit v1.2.3