diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-04-11 06:49:10 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-04-11 06:49:10 +0200 |
commit | 8ff4d1473da72e93780385acf193300ae9134af1 (patch) | |
tree | 3999770592480dc398ff099f4e293cf98a0f33e9 /src | |
parent | 95da90af2235da1cf51bc41a4096db7ccb532d17 (diff) |
Handle file:/// URLs as local paths in --start-at
Diffstat (limited to 'src')
-rw-r--r-- | src/options.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/options.c b/src/options.c index 19f8db9..5426a0b 100644 --- a/src/options.c +++ b/src/options.c @@ -849,9 +849,18 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) } } else if (finalrun && !opt.filelistfile && !opt.bgmode) { - if (opt.start_list_at && path_is_url(opt.start_list_at)) { + /* + * if --start-at is a non-local URL (i.e., does not start with file:///), + * behave as if "feh URL" was called (there is no directory we can load) + */ + if (opt.start_list_at && path_is_url(opt.start_list_at) && (strlen(opt.start_list_at) <= 8 || strncmp(opt.start_list_at, "file:///", 8) != 0)) { add_file_to_filelist_recursively(opt.start_list_at, FILELIST_FIRST); } else if (opt.start_list_at && strrchr(opt.start_list_at, '/')) { + if (strlen(opt.start_list_at) > 8 && strncmp(opt.start_list_at, "file:///", 8) == 0) { + char *start_at_path = estrdup(opt.start_list_at + 7); + free(opt.start_list_at); + opt.start_list_at = start_at_path; + } char *target_directory = estrdup(opt.start_list_at); char *filename_start = strrchr(target_directory, '/'); if (filename_start) { |