Kalev Lember <kalevlember@xxxxxxxxx> wrote: > On 10/01/2014 03:07 PM, Björn Persson wrote: > > Kalev Lember <kalevlember@xxxxxxxxx> wrote: > >> # If no desktop files are installed, return immediately > >> if ! ls -A "$RPM_BUILD_ROOT"/usr/share/applications/ 2>/dev/null; then > >> exit 0 > >> fi > > > > That tests whether the directory exists, not whether it contains > > desktop files. If that's what you want, then > > «if [ -d "$RPM_BUILD_ROOT"/usr/share/applications/ ]; then» would be > > much less confusing code. > > Yes indeed, I seem to have gotten it wrong. What I wanted to test was > not for the directory, but for the files inside. Would something like > this work better? > > if ! ls "$RPM_BUILD_ROOT"/usr/share/applications/*.desktop &>/dev/null; then That should work, if you want to ignore files in subdirectories such as /usr/share/applications/kde4. Files without the .desktop suffix will of course also be ignored, should there be any. Björn Persson
Attachment:
signature.asc
Description: PGP signature
-- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct