From 3f2001e6bc6171ab53e1684187bc3407c119e955 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sun, 24 Feb 2019 19:05:55 +0100 Subject: [PATCH] Execute xdg-open in directory of current file instead of messing with path (fixes pwmt/zathura#58) --- zathura/links.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/zathura/links.c b/zathura/links.c index cbd8d39..64d451c 100644 --- a/zathura/links.c +++ b/zathura/links.c @@ -225,21 +225,14 @@ link_launch(zathura_t* zathura, const zathura_link_t* link) return; }; - char* path = NULL; - if (g_path_is_absolute(link->target.value) == TRUE) { - path = g_strdup(link->target.value); - } else { - const char* document = zathura_document_get_path(zathura->document); - char* dir = g_path_get_dirname(document); - path = g_build_filename(dir, link->target.value, NULL); - g_free(dir); - } + const char* document = zathura_document_get_path(zathura->document); + char* dir = g_path_get_dirname(document); - if (girara_xdg_open(path) == false) { + if (girara_xdg_open_with_working_directory(link->target.value, dir) == false) { girara_notify(zathura->ui.session, GIRARA_ERROR, _("Failed to run xdg-open.")); } - g_free(path); + g_free(dir); } void