diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-04-18 08:31:23 -0400 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-04-18 08:31:23 -0400 |
commit | 1bd5798221e26f8a7a10143bbe97bfef267fc647 (patch) | |
tree | 39c9ce4969896543204ce1968e116d7ed21f2637 | |
parent | daeb19780dcb021ee12ec5ebe2adbb8ad835c075 (diff) |
inotify: Support files in current working directory
-rw-r--r-- | src/winwidget.c | 9 |
1 files changed, 9 insertions, 0 deletions
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:"); |