From 1bd5798221e26f8a7a10143bbe97bfef267fc647 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 18 Apr 2019 08:31:23 -0400 Subject: inotify: Support files in current working directory --- src/winwidget.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/winwidget.c b/src/winwidget.c index ce06309..4cdb929 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -703,6 +703,15 @@ void winwidget_inotify_add(winwidget winwid, feh_file * file) D(("Adding inotify watch for %s\n", file->filename)); char dir[PATH_MAX]; feh_file_dirname(dir, file, PATH_MAX); + + /* + * Handle files without directory part, e.g. "feh somefile.jpg". + * These always reside in the current directory. + */ + if (dir[0] == '\0') { + dir[0] = '.'; + dir[1] = '\0'; + } winwid->inotify_wd = inotify_add_watch(opt.inotify_fd, dir, IN_CLOSE_WRITE | IN_MOVED_TO); if (winwid->inotify_wd < 0) weprintf("inotify_add_watch failed:"); -- cgit v1.2.3