summaryrefslogtreecommitdiffstats
path: root/mpd-notification.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2014-08-28 15:40:29 +0200
committerGravatar Christian Hesse <mail@eworm.de>2014-08-28 15:40:29 +0200
commite7e4b628bf7c39213f0a14b4fe36a54265f4c70d (patch)
tree4065ef5b352c660bde5381b4ecb5d604189dbf4a /mpd-notification.c
parent7424c76e1c1336f5245e4362ca0747db038db3c9 (diff)
downloadmpd-notification-e7e4b628bf7c39213f0a14b4fe36a54265f4c70d.tar.gz
mpd-notification-e7e4b628bf7c39213f0a14b4fe36a54265f4c70d.tar.zst
handle icon in root directory
Diffstat (limited to 'mpd-notification.c')
-rw-r--r--mpd-notification.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mpd-notification.c b/mpd-notification.c
index a225250..9625d57 100644
--- a/mpd-notification.c
+++ b/mpd-notification.c
@@ -57,7 +57,12 @@ char * get_icon(const char * music_dir, const char * uri) {
regex_t regex;
uri_dirname = strdup(uri);
- *strrchr(uri_dirname, '/') = 0;
+
+ /* cut the dirname or just use "." (string, not char!) for current directory */
+ if (strrchr(uri_dirname, '/') != NULL)
+ *strrchr(uri_dirname, '/') = 0;
+ else
+ strcpy(uri_dirname, ".");
if ((dir = opendir(uri_dirname)) == NULL) {
fprintf(stderr, "%s: Can not read directory '%s': ", program, uri_dirname);