From 33d5928322a85302ead199b76d3f553ed275485b Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erik.verbruggen@nokia.com>
Date: Thu, 18 Mar 2010 13:56:47 +0100
Subject: [PATCH] Added check to see if the passed path is correct by checking
 if it contains the file AST.h

---
 src/tools/cplusplus/generate-ast.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/tools/cplusplus/generate-ast.cpp b/src/tools/cplusplus/generate-ast.cpp
index 52d8b933c55..7051db24cee 100644
--- a/src/tools/cplusplus/generate-ast.cpp
+++ b/src/tools/cplusplus/generate-ast.cpp
@@ -1060,8 +1060,13 @@ int main(int argc, char *argv[])
     }
 
     QDir cplusplusDir(files.first());
-    Snapshot snapshot;
+    if (!QFileInfo(cplusplusDir, QLatin1String("AST.h")).exists()) {
+        std::cerr << "Cannot find AST.h in " << qPrintable(cplusplusDir.absolutePath())
+                << std::endl;
+        return EXIT_FAILURE;
+    }
 
+    Snapshot snapshot;
     QStringList astDerivedClasses = generateAST_H(snapshot, cplusplusDir);
     astDerivedClasses.sort();
     generateASTFwd_h(snapshot, cplusplusDir, astDerivedClasses);
-- 
GitLab