From fa04ff005b98b5b44ba53f034477fce5b103fbe9 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 20 Apr 2023 14:57:37 +0000 Subject: [PATCH] contrib: fix build_locale.sh to work with relative paths I think all scripts that call this file already used abs paths, but manual callers tend to use relative paths. --- contrib/build_locale.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contrib/build_locale.sh b/contrib/build_locale.sh index 425066754..a50f0eca4 100755 --- a/contrib/build_locale.sh +++ b/contrib/build_locale.sh @@ -8,16 +8,20 @@ if [[ ! -d "$1" || -z "$2" ]]; then exit 1 fi +# convert $1 and $2 to abs paths +SRC_DIR="$(realpath "$1" 2> /dev/null || grealpath "$1")" +DST_DIR="$(realpath "$2" 2> /dev/null || grealpath "$2")" + if ! which msgfmt > /dev/null 2>&1; then echo "Please install gettext" exit 1 fi -cd "$1" -mkdir -p "$2" +cd "$SRC_DIR" +mkdir -p "$DST_DIR" for i in *; do - dir="$2/$i/LC_MESSAGES" + dir="$DST_DIR/$i/LC_MESSAGES" mkdir -p "$dir" (msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true) done