From 9e41dfbbffc59fab90aeb7bae34f2ca91c23b16e Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 28 Apr 2020 13:12:24 +0100 Subject: libcamera: utils: Identify the 'real' build path Call realpath() to strip out any levels of indirection required in referencing the root build directory. This simplifies the debug output when reporting and parsing paths. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/utils.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp index a96ca7f4..fbadf350 100644 --- a/src/libcamera/utils.cpp +++ b/src/libcamera/utils.cpp @@ -386,7 +386,16 @@ std::string libcameraBuildPath() if (ret == 0) return std::string(); - return dirname(info.dli_fname) + "/../../"; + std::string path = dirname(info.dli_fname) + "/../../"; + + char *real = realpath(path.c_str(), nullptr); + if (!real) + return std::string(); + + path = real; + free(real); + + return path + "/"; } /** -- cgit v1.2.1