Navigation Menu

Skip to content

Commit

Permalink
Check if directories exist before try to \'find\' files in them.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfmorel committed Apr 3, 2013
1 parent 536010f commit 3412c9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cdm
Expand Up @@ -85,7 +85,7 @@ cktimeout=${cktimeout:-30}
# Offer all available sessions in /etc/X11/Sessions,
# if $binlist if not explicitly set in cdmrc.

if [[ "${#binlist[@]}" == 0 ]]; then
if [[ "${#binlist[@]}" == 0 && -d /etc/X11/Sessions ]]; then
binlist=($(find /etc/X11/Sessions -maxdepth 1 -type f))
flaglist=($(sed 's/[[:digit:]]\+/X/g' <<< ${!binlist[@]}))
namelist=(${binlist[@]##*/})
Expand All @@ -94,7 +94,7 @@ fi
# If $binlist is not set in cdmrc or by files in /etc/X11/Sessions,
# try .desktop files in /usr/share/xsessions/ .

if [[ "${#binlist[@]}" == 0 ]]; then
if [[ "${#binlist[@]}" == 0 && -d /usr/share/xsessions ]]; then
desktopsessions=($(find /usr/share/xsessions/ -regex .\*.desktop))
#TODO: allow full quoting and expansion according to desktop entry spec:
# http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables
Expand Down

0 comments on commit 3412c9d

Please sign in to comment.