From: Yonghong Zhu Date: Fri, 3 Jun 2016 01:29:06 +0000 (+0800) Subject: BaseTools: Add error handling for current_dir is not exist X-Git-Tag: edk2-stable201903~6898 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=570ae1ebc857d27e73210e034fef0082df17dc29 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 --- 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 = {