eutils.eclass: make_desktop_entry, replace unnecessary extglob
authorMichał Górny <mgorny@gentoo.org>
Fri, 14 Apr 2017 17:20:57 +0000 (19:20 +0200)
committerMichał Górny <mgorny@gentoo.org>
Tue, 25 Apr 2017 17:57:53 +0000 (19:57 +0200)
Replace the unnecessary use of extglob to strip file suffix
in make_desktop_entry with a plain ${x%.*}. This is pretty much
equivalent since match to one of the pre-defined suffixes is already
confirmed via the preceding conditional, and avoiding repeating
the suffix list twice makes the code simpler.

eclass/eutils.eclass

index ea2a76200f093aa7a431edea9fb0e7f7fc7d353b..e66b40424234eb8129dc0767a3a41de466861b6e 100644 (file)
@@ -275,13 +275,11 @@ make_desktop_entry() {
        # Don't append another ";" when a valid category value is provided.
        type=${type%;}${type:+;}
 
-       eshopts_push -s extglob
        if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
                ewarn "As described in the Icon Theme Specification, icon file extensions are not"
                ewarn "allowed in .desktop files if the value is not an absolute path."
-               icon=${icon%.@(xpm|png|svg)}
+               icon=${icon%.*}
        fi
-       eshopts_pop
 
        cat <<-EOF > "${desktop}"
        [Desktop Entry]