wesnoth/utils/travis/check_utf8.sh
Gunter Labes 40a343268a
Check if isutf8 is installed and exit 0 if not
We don't want to exit with failure if the tool is not installed.
Simplified exclusion of certain file extensions.
2019-07-29 20:54:08 +02:00

23 lines
803 B
Bash
Executable File

#!/bin/bash
# Install isutf8 program (from package "moreutils" at least in linux mint) in order to use this script.
#
# This script assumes that the current working directory is the root of the wesnoth repository.
command -v isutf8 >/dev/null || { echo "Install 'isutf8' from moreutils to use this script."; exit 0; }
exit_code=0
find src/ -type f -print0 | xargs -0 isutf8 -- || exit_code=1
for ex in png ogg jpg wav gif xcf bin; do args+=(! -name "*.$ex"); done
find data/ -type f "${args[@]}" ! -name "test_cve_2018_1999023_2.cfg" -print0 | xargs -0 isutf8 -- || exit_code=1
find po/ -type f -print0 | xargs -0 isutf8 -- || exit_code=1
isutf8 changelog.md || exit_code=1
isutf8 RELEASE_NOTES || exit_code=1
if [ $exit_code != 0 ]; then
echo "Found invalid UTF8 file(s)!"
fi
exit $exit_code