diff --git a/man/feh.pre b/man/feh.pre index 7f7ef6bb79e90bf922cb5b7ef9920014ed7e373a..bb75469d9406f9fbe8af50ce0cd5eb834e480e6e 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 361ac19149a4c88105684e479d72e0fd469a56ad..ae8d7b2e701e0c78892e30cb02f0a59029ecb7a1 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);