fix(gnome-extensions): Don't fail if extension is supplied with empty locale folder

Fixes installation of Default Workspace extension, which is packages with an empty `locale` folder.
This commit is contained in:
fiftydinar 2025-03-13 19:27:36 +01:00 committed by GitHub
parent 797519720b
commit 4ac40ed042
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -115,10 +115,13 @@ if [[ ${#INSTALL[@]} -gt 0 ]]; then
# Locale is not crucial for extensions to work, as they will fallback to gschema.xml
# Some of them might not have any locale at the moment
# So that's why I made a check for directory
# I made an additional check if language files are available, in case if extension is packaged with an empty folder, like with Default Workspace extension
if [[ -d "${TMP_DIR}/locale" ]]; then
echo "Installing language extension files"
install -d -m 0755 "/usr/share/locale/"
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/"
if ls "${TMP_DIR}/locale/"*.mo 1> /dev/null 2>&1; then
echo "Installing language extension files"
install -d -m 0755 "/usr/share/locale/"
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/"
fi
fi
# Delete the temporary directory
echo "Cleaning up the temporary directory"
@ -221,10 +224,13 @@ if [[ ${#INSTALL[@]} -gt 0 ]] && ! "${LEGACY}"; then
# Locale is not crucial for extensions to work, as they will fallback to gschema.xml
# Some of them might not have any locale at the moment
# So that's why I made a check for directory
# I made an additional check if language files are available, in case if extension is packaged with an empty folder, like with Default Workspace extension
if [[ -d "${TMP_DIR}/locale" ]]; then
echo "Installing language extension files"
install -d -m 0755 "/usr/share/locale/"
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/"
if ls "${TMP_DIR}/locale/"*.mo 1> /dev/null 2>&1; then
echo "Installing language extension files"
install -d -m 0755 "/usr/share/locale/"
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/"
fi
fi
# Delete the temporary directory
echo "Cleaning up the temporary directory"