Revision df5aa9b6

View differences:

tools/ide/QtCreator/QtCreatorSetup.sh
293 293
  fi
294 294

  
295 295
  # check for existing project files
296
  local projectfiles="$(find ${projectdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$")"
297
  IFS=$'\n'; projectfiles=($projectfiles); unset IFS
298
  if [ ! -z "${projectfiles[*]}" ]; then
296
  local projectfiles=($(find ${projectdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$"))
297
  if [ ${#projectfiles[@]} != 0 ]; then
299 298
    printWarning "The following files will be overwritten:\n"
300 299
    for pfile in ${projectfiles[@]}; do
301 300
      printWarning "\t$(basename $pfile)\n"
......
331 330
  local sourcefiles=()
332 331
  local sourcefile=""
333 332
  local parse_state="WAIT_FOR_INCLUDE_COMPILE_MAKE"
333
  local makedir=""
334 334
  local makedirs=()
335
  local quotes="\'\"\´\`\„\“"
335 336
  # capture all output from make and GCC and append the return value of make as last line
336 337
  printInfo "processing project (this may take a while)...\n"
337 338
  local rawout=$(make --directory ${modulesdir}/${module} --always-make USE_OPT="-v -E -H" USE_VERBOSE_COMPILE="no" OUTFILES="" 2>&1 && echo $?)
......
363 364
          printf "."
364 365
          sourcefile=${BASH_REMATCH[1]}
365 366
          parse_state="WAIT_FOR_COMPILERCALL"
366
        # if make is called again in another directory, a message appears like:
367
        # if make is called again in another directory or a nested make call leaves the directory, a message appears like:
367 368
        # make[1]: Entering directory 'directory'
368
        elif [[ "$line" =~ ^make(\[[0-9]+\])?:\ Entering\ directory\ \'.+\'$ ]]; then
369
          makedirs+=($(echo "$line" | (cut -d "'" -f 2)))
370
        # if make is leaving a directory, a message appears like:
371
        # make[1]: Leaving directory 'directory'
372
        elif [[ "$line" =~ ^make(\[[0-9]+\])?:\ Leaving\ directory\ \'.+\'$ ]]; then
373
          unset makedirs[-1]
369
        # make[999]: Verzeichnis „directory“ wird verlassen
370
        elif [[ "$line" =~ ^make(\[[0-9]+\])?:([[:alnum:]]|[[:blank:]])*[$quotes].*[$quotes]([[:alnum:]]|[[:blank:]])*$ ]]; then
371
          # extract directory path
372
          makedir=$(echo ${line} | grep -oE "[${quotes}].*[${quotes}]" | grep -oE "[^${quotes}].*[^${quotes}]")
373
          # if the makedirs stack is empty or the directory does not mathc the last entry
374
          if [ ${#makedirs[@]} == 0 ] || [ "${makedir}" != "${makedirs[-1]}" ]; then
375
            # push the directory to the stack
376
            makedirs+=(${makedir})
377
          else
378
            # pop the directory from the stack
379
            unset makedirs[-1]
380
          fi
374 381
        fi;;
375 382
      WAIT_FOR_COMPILERCALL)
376 383
        # wait for the actual call of the compiler to retrieve the full path to the source file
......
510 517
  fi
511 518

  
512 519
  # check for existing project files
513
  local projectfiles=""
520
  local projectfiles=()
514 521
  for module in ${modules[@]}; do
515
    projectfiles+="$(find ${projectsdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$")"
522
    projectfiles+=($(find ${projectsdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$"))
516 523
  done
517
  IFS=$'\n'; projectfiles=($projectfiles); unset IFS
518
  if [ ! -z "${projectfiles[*]}" ]; then
524
  if [ ${#projectfiles[@]} != 0 ]; then
519 525
    printWarning "The following files will be removed:\n"
520 526
    for pfile in ${projectfiles[@]}; do
521 527
      printWarning "\t$(basename $pfile)\n"
......
526 532
    case "${userinput}" in
527 533
      Y|y)
528 534
        for pfile in ${projectfiles[*]}; do
529
          rm "$pfile"
535
          rm "$pfile" 2>&1 | tee -a $LOG_FILE
530 536
        done
531 537
        ;;
532 538
      N|n)
......
582 588
  local projectdir=""
583 589
  local outvar=""
584 590
  local wipe=false
585
  local files=""
591
  local files=()
586 592

  
587 593
  # parse arguments
588 594
  local otherargs=()
......
620 626
  # list all files to be deleted
621 627
  if [ -z "$modulename" ]; then
622 628
    if [ $wipe != true ]; then
623
      files=$(find "${projectdir}" -maxdepth 1 -type f | grep -E "^.+\.(includes|files|config|creator|cflags|cxxflags)$")
629
      files=($(find "${projectdir}" -maxdepth 1 -type f | grep -E "^.+\.(includes|files|config|creator|cflags|cxxflags)$"))
624 630
    else
625
      files=$(find "${projectdir}" -maxdepth 1 -type f | grep -E "^.+\.(includes|files|config|creator|cflags|cxxflags|creator(\.user(\..+)?)?)$")
631
      files=($(find "${projectdir}" -maxdepth 1 -type f | grep -E "^.+\.(includes|files|config|creator|cflags|cxxflags|creator(\.user(\..+)?)?)$"))
626 632
    fi
627 633
  else
628 634
    if [ $wipe != true ]; then
629
      files=$(find "${projectdir}" -maxdepth 1 -type f | grep -E "^${modulename}\.(includes|files|config|creator|cflags|cxxflags)$")
635
      files=($(find "${projectdir}" -maxdepth 1 -type f | grep -E "^${modulename}\.(includes|files|config|creator|cflags|cxxflags)$"))
630 636
    else
631
      files=$(find "${projectdir}" -maxdepth 1 -type f | grep -E "^${modulename}\.(includes|files|config|creator|cflags|cxxflags|creator(\.user(\..+)?)?)$")
637
      files=($(find "${projectdir}" -maxdepth 1 -type f | grep -E "^${modulename}\.(includes|files|config|creator|cflags|cxxflags|creator(\.user(\..+)?)?)$"))
632 638
    fi
633 639
  fi
634
  if [ ! -z "$files" ]; then
640
  if [ ${#files[@]} != 0 ]; then
635 641
    printInfo "Deleting the following files:\n"
636
    while read line; do
637
      printInfo "\t$(basename ${line})\n"
638
      rm ${line} 2>&1 | tee -a $LOG_FILE
639
    done <<< "${files}"
642
    for file in ${files[@]}; do
643
      printInfo "\t$(basename ${file})\n"
644
      rm ${file} 2>&1 | tee -a $LOG_FILE
645
    done
640 646
  else
641 647
    printInfo "No project files found\n"
642 648
  fi

Also available in: Unified diff