BaseTools: Add error handling for current_dir is not exist
authorYonghong Zhu <yonghong.zhu@intel.com>
Fri, 3 Jun 2016 01:29:06 +0000 (09:29 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sat, 4 Jun 2016 13:20:23 +0000 (21:20 +0800)
Add the error handling to cover the case that current_dir is not exist.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/GenMake.py

index 475b794fe820a9c120b92287268855b542e04ccc..4b2902f47330b57d5cbe2f94bd1c1d4a53840c90 100644 (file)
@@ -597,10 +597,11 @@ cleanlib:
         while not found and os.sep in package_rel_dir:\r
             index = package_rel_dir.index(os.sep)\r
             current_dir = mws.join(current_dir, package_rel_dir[:index])\r
-            for fl in os.listdir(current_dir):\r
-                if fl.endswith('.dec'):\r
-                    found = True\r
-                    break\r
+            if os.path.exists(current_dir):\r
+                for fl in os.listdir(current_dir):\r
+                    if fl.endswith('.dec'):\r
+                        found = True\r
+                        break\r
             package_rel_dir = package_rel_dir[index + 1:]\r
 \r
         MakefileTemplateDict = {\r