Reviewed-by: Liming Gao <[email protected]>

> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Friday, June 03, 2016 10:16 AM
> To: [email protected]
> Cc: Gao, Liming <[email protected]>
> Subject: [Patch V2] 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 <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu <[email protected]>
> ---
>  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 475b794..4b2902f 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -595,14 +595,15 @@ cleanlib:
>          current_dir = self.Macros["WORKSPACE"]
>          found = False
>          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 = {
>              "makefile_header"           : self._FILE_HEADER_[self._FileType],
>              "makefile_path"             : os.path.join("$(MODULE_BUILD_DIR)",
> MakefileName),
> --
> 2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to