update.sh 571 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. set -e
  3. ROOT="$(pwd)"
  4. SRC=${ROOT}/src
  5. LUPDATE_BIN=${LUPDATE_BIN:-lupdate}
  6. ###############################################################################
  7. readarray -d '' SOURCE_FILES < <(find "$SRC" -regex '.*\.\(h\|cpp\|ui\)' -type f -print0)
  8. update_file() {
  9. ts_file="$1"
  10. echo "Updating $ts_file..."
  11. # Update .ts
  12. $LUPDATE_BIN "${SOURCE_FILES[@]}" -locations "absolute" -ts "$ts_file"
  13. }
  14. cd "$ROOT"
  15. if [ -n "$1" ]; then
  16. update_file "$1"
  17. else
  18. for f in *.ts; do
  19. update_file "$f"
  20. done
  21. update_file .template.ts
  22. fi