summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-12-24 10:16:51 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-12-24 10:17:01 +0100
commitf2364294d76a6830605ac9375cb0c976346a3e5e (patch)
tree04392510d579c32e014447a634aee6416b1a9cde
parentda20545146b0248efc71deebc45e1d94d66b6ea6 (diff)
save_filelist: Respect --output-dir
Closes #577
-rw-r--r--man/feh.pre12
-rw-r--r--src/filelist.c11
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);