summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2020-04-28 13:12:24 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-04-30 10:24:24 +0100
commit9e41dfbbffc59fab90aeb7bae34f2ca91c23b16e (patch)
treef1516b04bdd85942233f86f5c60f190d453b63a4
parent389c19c267cb20312a0fd895c2418da73c91283d (diff)
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 <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/utils.cpp11
1 files changed, 10 insertions, 1 deletions
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 + "/";
}
/**