mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-13 09:13:45 +01:00
Execute xdg-open in directory of current file instead of messing with path (fixes pwmt/zathura#58)
This commit is contained in:
parent
f938f4769c
commit
3f2001e6bc
@ -225,21 +225,14 @@ link_launch(zathura_t* zathura, const zathura_link_t* link)
|
|||||||
return;
|
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);
|
const char* document = zathura_document_get_path(zathura->document);
|
||||||
char* dir = g_path_get_dirname(document);
|
char* dir = g_path_get_dirname(document);
|
||||||
path = g_build_filename(dir, link->target.value, NULL);
|
|
||||||
g_free(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
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."));
|
girara_notify(zathura->ui.session, GIRARA_ERROR, _("Failed to run xdg-open."));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(path);
|
g_free(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user