Revision 23230307

View differences:

tools/ide/QtCreator/QtCreatorSetup.sh
517 517
  fi
518 518

  
519 519
  # check for existing project files
520
  if [ -f ${projectdir}/${module}.includes ] || [ -f ${projectdir}/${module}.files ] || [ -f ${projectdir}/${module}.config ] || [ -f ${projectdir}/${module}.creator ]; then
520
  local projectfiles="$(find ${projectdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$")"
521
  IFS=$'\n'; projectfiles=($projectfiles); unset IFS
522
  if [ ! -z "${projectfiles[*]}" ]; then
521 523
    printWarning "The following files will be overwritten:\n"
522
    if [ -f ${projectdir}/${module}.includes ]; then
523
      printWarning "\t${module}.includes\n"
524
    fi
525
    if [ -f ${projectdir}/${module}.files ]; then
526
      printWarning "\t${module}.files\n"
527
    fi
528
    if [ -f ${projectdir}/${module}.config ]; then
529
      printWarning "\t${module}.config\n"
530
    fi
531
    if [ -f ${projectdir}/${module}.creator ]; then
532
      printWarning "\t${module}.creator\n"
533
    fi
524
    for pfile in ${projectfiles[@]}; do
525
      printWarning "\t$(basename $pfile)\n"
526
    done
534 527
    local userinput=""
535 528
    printInfo "Continue and overwrite? [y/n]\n"
536 529
    readUserInput "YyNn" userinput
......
670 663
#                 If this optional arguments is absent, ths function will ask for user input.
671 664
# return:     0
672 665
#                 No error or warning occurred.
666
#             1
667
#                 Aborted by user.
673 668
#             -1
674 669
#                 No modules available.
675 670
#
......
721 716
    getProjectDir projectdir
722 717
  fi
723 718

  
719
  # check for existing project files
720
  local projectfiles=()
721
  for module in ${modules[@]}; do
722
    local pfiles="$(find ${projectdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$")"
723
    IFS=$'\n'; pfiles=($pfiles); unset IFS
724
    projectfiles=( ${projectfiles[*]} ${pfiles[*]} )
725
  done
726
  if [ ! -z "${projectfiles[*]}" ]; then
727
    printWarning "The following files will be removed:\n"
728
    for pfile in ${projectfiles[@]}; do
729
      printWarning "\t$(basename $pfile)\n"
730
    done
731
    local userinput=""
732
    printInfo "Continue and overwrite? [y/n]\n"
733
    readUserInput "YyNn" userinput
734
    case "${userinput}" in
735
      Y|y)
736
        for pfile in ${projectfiles[*]}; do
737
          rm "$pfile"
738
        done
739
        ;;
740
      N|n)
741
        printWarning "Project generation aborted by user\n"
742
        return 1
743
        ;;
744
      *)
745
        printError "unexpected input: ${userinput}\n"
746
        return 999
747
        ;;
748
    esac
749
  fi
750

  
724 751
  # print message
725 752
  printf "\n"
726 753
  printInfo "generating QtCreator project files for all modules...\n"

Also available in: Unified diff