From 7191f47c7bfc2571bc03d5860e58d11fca7b4575 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Mon, 12 Jun 2017 16:49:31 +0430 Subject: fixed the new command --- bruiser/bruiser.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'bruiser') diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp index 32100dd..86e2cd7 100644 --- a/bruiser/bruiser.cpp +++ b/bruiser/bruiser.cpp @@ -194,6 +194,18 @@ class CompilationDatabaseProcessor //PRINT_WITH_COLOR_LB(RED, MakePath.c_str()); } + bool CompilationDatabseIsEmpty(void) + { + std::vector CCV = CDB.getAllCompileCommands(); + + if(CCV.empty()) + { + return true; + } + + return false; + } + std::string GetMakePath(void) { return this->MakePath; @@ -1143,9 +1155,19 @@ int main(int argc, const char **argv) /*populating the shellglobalinstance*/ CompilationDatabaseProcessor CDBP(CDB); - CDBP.CalcMakePath(); - CDBP.PopulateGPATH(); - CDBP.PopulateGSOURCEFILES(); + + /*checking whether the compilation database is found and not empty*/ + if (CDBP.CompilationDatabseIsEmpty()) + { + PRINT_WITH_COLOR_LB(RED, "bruiser could not find the compilation database."); + //return 1; + } + else + { + CDBP.CalcMakePath(); + CDBP.PopulateGPATH(); + CDBP.PopulateGSOURCEFILES(); + } /*initialize the LuaWrapper class so we can register and run them from lua.*/ LuaWrapper LW(Tool); -- cgit v1.2.3