Added code to check if "cmd" attribute is valid or not. This is to make error report...
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / userdefine / UserDefineDef.java
index d983880..9b66ebe 100644 (file)
@@ -227,6 +227,13 @@ public class UserDefineDef extends ProcessorDef {
         if (isReference()) {\r
             throw tooManyAttributes();\r
         }\r
+        if (cmd == null || cmd.trim().length() == 0) {\r
+            throw new BuildException("cmd attribute is empty!");\r
+        }\r
+        File cmdProgram = new File(cmd);\r
+        if (cmdProgram.isDirectory()) {\r
+            throw new BuildException(cmd + " is not valid or executable!");\r
+        }\r
         this.cmd = cmd;\r
     }\r
 \r