Skip to content

Commit 8a66d37

Browse files
committed
generate-desktop.sh: Stop using unportable GNU grep -P
This doesn't work on Chimera Linux which uses the FreeBSD grep(1)
1 parent 67822ca commit 8a66d37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

generate-desktop.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if [ ! -f "${SRC_DIR}/i18n/${APPLICATION_NAME}.desktop.h" ]; then
4747
exit 2
4848
fi
4949

50-
DEFAULT_NAME=$(grep -oP '//% "\K[^"]+(?=")' "${SRC_DIR}/i18n/${APPLICATION_NAME}.desktop.h")
50+
DEFAULT_NAME=$(sed -n 's/\/\/% //p' "${SRC_DIR}/i18n/${APPLICATION_NAME}.desktop.h" | cut -d'"' -f2)
5151
if [ -z "$DEFAULT_NAME" ]; then
5252
echo "Default name can not be found in ${SRC_DIR}/i18n/${APPLICATION_NAME}.desktop.h"
5353
exit 3
@@ -59,7 +59,7 @@ echo "Name=$DEFAULT_NAME" >> "$OUTPUT_FILE"
5959
for FILE in "${SRC_DIR}"/i18n/*.ts; do
6060
echo "Processing $FILE..."
6161

62-
PROCESSED_LANG=$(grep -oP 'language="\K[^"]+(?=")' "$FILE")
62+
PROCESSED_LANG=$(xmllint --xpath 'string(//TS/@language)' "$FILE")
6363
if [ -z "$PROCESSED_LANG" ]; then
6464
echo "> Couldn't find a corresponding language id, aborting"
6565
continue
@@ -78,7 +78,7 @@ for FILE in "${SRC_DIR}"/i18n/*.ts; do
7878
continue
7979
fi
8080

81-
TRANSLATED_NAME=$(echo "$TRANSLATION_LINE" | grep -oP '>\K[^<]*(?=</translation>)')
81+
TRANSLATED_NAME=$(echo "$TRANSLATION_LINE" | xmllint --xpath 'string(//translation)' -) # TODO: 2>/dev/null ?
8282
if [ -z "$TRANSLATED_NAME" ]; then
8383
echo "> Translation is empty, aborting"
8484
continue

0 commit comments

Comments
 (0)