From f2364294d76a6830605ac9375cb0c976346a3e5e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 24 Dec 2020 10:16:51 +0100 Subject: save_filelist: Respect --output-dir Closes #577 --- man/feh.pre | 12 +++++++++--- src/filelist.c | 11 ++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/man/feh.pre b/man/feh.pre index 7f7ef6b..bb75469 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -671,7 +671,7 @@ Save files to .Ar directory when using .Cm --keep-http -or the save_image command. +or the save_image or save_filelist command. By default, files are saved in the current working directory. . .It Cm -p , --preload @@ -1576,7 +1576,10 @@ will keep zoom and X, Y offset when switching images. .It L Bq save_filelist . Save the current filelist as -.Qq feh_PID_ID_filelist +.Qq feh_PID_ID_filelist . +It is saved in the directory specified by +.Cm --output-dir , +if set, and in the current working directory otherwise. . .It m Bq toggle_menu . @@ -1612,7 +1615,10 @@ Useful for webcams .It s Bq save_image . Save the current image as -.Qq feh_PID_ID_FILENAME +.Qq feh_PID_ID_FILENAME . +It is saved in the directory specified by +.Cm --output-dir , +if set, and in the current working directory otherwise. . .It w Bq size_to_image . diff --git a/src/filelist.c b/src/filelist.c index 361ac19..ae8d7b2 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -659,8 +659,17 @@ char *feh_absolute_path(char *path) void feh_save_filelist() { char *tmpname; + char *base_dir = ""; - tmpname = feh_unique_filename("", "filelist"); + if (opt.output_dir) { + base_dir = estrjoin("", opt.output_dir, "/", NULL); + } + + tmpname = feh_unique_filename(base_dir, "filelist"); + + if (opt.output_dir) { + free(base_dir); + } if (opt.verbose) fprintf(stderr, "saving filelist to filename '%s'\n", tmpname); -- cgit v1.2.3