diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2020-04-28 13:12:24 +0100 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2020-04-30 10:24:24 +0100 |
commit | 9e41dfbbffc59fab90aeb7bae34f2ca91c23b16e (patch) | |
tree | f1516b04bdd85942233f86f5c60f190d453b63a4 /src | |
parent | 389c19c267cb20312a0fd895c2418da73c91283d (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>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/utils.cpp | 11 |
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 + "/"; } /** |