commit df5aa9b6666af0b66532e942aabb960cfe5aa13a
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Wed Jun 3 14:10:46 2020 +0200

    QtCreator setup script: fixed several issues

diff --git a/tools/ide/QtCreator/QtCreatorSetup.sh b/tools/ide/QtCreator/QtCreatorSetup.sh
index 7d09161..65e2a44 100755
--- a/tools/ide/QtCreator/QtCreatorSetup.sh
+++ b/tools/ide/QtCreator/QtCreatorSetup.sh
@@ -293,9 +293,8 @@ function createModuleProject {
   fi
 
   # check for existing project files
-  local projectfiles="$(find ${projectdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$")"
-  IFS=$'\n'; projectfiles=($projectfiles); unset IFS
-  if [ ! -z "${projectfiles[*]}" ]; then
+  local projectfiles=($(find ${projectdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$"))
+  if [ ${#projectfiles[@]} != 0 ]; then
     printWarning "The following files will be overwritten:\n"
     for pfile in ${projectfiles[@]}; do
       printWarning "\t$(basename $pfile)\n"
@@ -331,7 +330,9 @@ function createModuleProject {
   local sourcefiles=()
   local sourcefile=""
   local parse_state="WAIT_FOR_INCLUDE_COMPILE_MAKE"
+  local makedir=""
   local makedirs=()
+  local quotes="\'\"\´\`\„\“"
   # capture all output from make and GCC and append the return value of make as last line
   printInfo "processing project (this may take a while)...\n"
   local rawout=$(make --directory ${modulesdir}/${module} --always-make USE_OPT="-v -E -H" USE_VERBOSE_COMPILE="no" OUTFILES="" 2>&1 && echo $?)
@@ -363,14 +364,20 @@ function createModuleProject {
           printf "."
           sourcefile=${BASH_REMATCH[1]}
           parse_state="WAIT_FOR_COMPILERCALL"
-        # if make is called again in another directory, a message appears like:
+        # if make is called again in another directory or a nested make call leaves the directory, a message appears like:
         # make[1]: Entering directory 'directory'
-        elif [[ "$line" =~ ^make(\[[0-9]+\])?:\ Entering\ directory\ \'.+\'$ ]]; then
-          makedirs+=($(echo "$line" | (cut -d "'" -f 2)))
-        # if make is leaving a directory, a message appears like:
-        # make[1]: Leaving directory 'directory'
-        elif [[ "$line" =~ ^make(\[[0-9]+\])?:\ Leaving\ directory\ \'.+\'$ ]]; then
-          unset makedirs[-1]
+        # make[999]: Verzeichnis „directory“ wird verlassen
+        elif [[ "$line" =~ ^make(\[[0-9]+\])?:([[:alnum:]]|[[:blank:]])*[$quotes].*[$quotes]([[:alnum:]]|[[:blank:]])*$ ]]; then
+          # extract directory path
+          makedir=$(echo ${line} | grep -oE "[${quotes}].*[${quotes}]" | grep -oE "[^${quotes}].*[^${quotes}]")
+          # if the makedirs stack is empty or the directory does not mathc the last entry
+          if [ ${#makedirs[@]} == 0 ] || [ "${makedir}" != "${makedirs[-1]}" ]; then
+            # push the directory to the stack
+            makedirs+=(${makedir})
+          else
+            # pop the directory from the stack
+            unset makedirs[-1]
+          fi
         fi;;
       WAIT_FOR_COMPILERCALL)
         # wait for the actual call of the compiler to retrieve the full path to the source file
@@ -510,12 +517,11 @@ function createAllProjects {
   fi
 
   # check for existing project files
-  local projectfiles=""
+  local projectfiles=()
   for module in ${modules[@]}; do
-    projectfiles+="$(find ${projectsdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$")"
+    projectfiles+=($(find ${projectsdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$"))
   done
-  IFS=$'\n'; projectfiles=($projectfiles); unset IFS
-  if [ ! -z "${projectfiles[*]}" ]; then
+  if [ ${#projectfiles[@]} != 0 ]; then
     printWarning "The following files will be removed:\n"
     for pfile in ${projectfiles[@]}; do
       printWarning "\t$(basename $pfile)\n"
@@ -526,7 +532,7 @@ function createAllProjects {
     case "${userinput}" in
       Y|y)
         for pfile in ${projectfiles[*]}; do
-          rm "$pfile"
+          rm "$pfile" 2>&1 | tee -a $LOG_FILE
         done
         ;;
       N|n)
@@ -582,7 +588,7 @@ function deleteProjects {
   local projectdir=""
   local outvar=""
   local wipe=false
-  local files=""
+  local files=()
 
   # parse arguments
   local otherargs=()
@@ -620,23 +626,23 @@ function deleteProjects {
   # list all files to be deleted
   if [ -z "$modulename" ]; then
     if [ $wipe != true ]; then
-      files=$(find "${projectdir}" -maxdepth 1 -type f | grep -E "^.+\.(includes|files|config|creator|cflags|cxxflags)$")
+      files=($(find "${projectdir}" -maxdepth 1 -type f | grep -E "^.+\.(includes|files|config|creator|cflags|cxxflags)$"))
     else
-      files=$(find "${projectdir}" -maxdepth 1 -type f | grep -E "^.+\.(includes|files|config|creator|cflags|cxxflags|creator(\.user(\..+)?)?)$")
+      files=($(find "${projectdir}" -maxdepth 1 -type f | grep -E "^.+\.(includes|files|config|creator|cflags|cxxflags|creator(\.user(\..+)?)?)$"))
     fi
   else
     if [ $wipe != true ]; then
-      files=$(find "${projectdir}" -maxdepth 1 -type f | grep -E "^${modulename}\.(includes|files|config|creator|cflags|cxxflags)$")
+      files=($(find "${projectdir}" -maxdepth 1 -type f | grep -E "^${modulename}\.(includes|files|config|creator|cflags|cxxflags)$"))
     else
-      files=$(find "${projectdir}" -maxdepth 1 -type f | grep -E "^${modulename}\.(includes|files|config|creator|cflags|cxxflags|creator(\.user(\..+)?)?)$")
+      files=($(find "${projectdir}" -maxdepth 1 -type f | grep -E "^${modulename}\.(includes|files|config|creator|cflags|cxxflags|creator(\.user(\..+)?)?)$"))
     fi
   fi
-  if [ ! -z "$files" ]; then
+  if [ ${#files[@]} != 0 ]; then
     printInfo "Deleting the following files:\n"
-    while read line; do
-      printInfo "\t$(basename ${line})\n"
-      rm ${line} 2>&1 | tee -a $LOG_FILE
-    done <<< "${files}"
+    for file in ${files[@]}; do
+      printInfo "\t$(basename ${file})\n"
+      rm ${file} 2>&1 | tee -a $LOG_FILE
+    done
   else
     printInfo "No project files found\n"
   fi
