From 81e75539b34357ca6c4e7418bc868d3b4289b905 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Fri, 27 Dec 2013 20:40:06 +0100 Subject: [PATCH] Use fullpath in for --syntex-forward Signed-off-by: Sebastian Ramacher --- main.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index dfc1f81..5e7d168 100644 --- a/main.c +++ b/main.c @@ -1,11 +1,17 @@ /* See LICENSE file for license and copyright information */ +#define _BSD_SOURCE +#define _XOPEN_SOURCE 700 + +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include +#include #include #include "zathura.h" @@ -100,10 +106,19 @@ main(int argc, char* argv[]) return -1; } - if (synctex_forward_position(argv[1], synctex_fwd) == true) { + char* real_path = realpath(argv[1], NULL); + if (real_path == NULL) { + girara_error("Failed to determine real path: %s", strerror(errno)); + return -1; + } + + const bool ret = synctex_forward_position(argv[1], synctex_fwd); + free(real_path); + + if (ret == true) { return 0; } else { - girara_error("Could not find open instance for '%s'", argv[1]); + girara_error("Could not find open instance for '%s'", real_path); return -1; } }