[libcamera-devel] [PATCH] libcamera: utils: Identify the 'real' build path
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Apr 29 17:42:14 CEST 2020
Hi Kieran,
Thank you for the patch.
On Wed, Apr 29, 2020 at 04:19:19PM +0100, Kieran Bingham wrote:
> 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.
Have you read the implementation fo libcameraSourcePath() by any chance
? :-)
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> src/libcamera/utils.cpp | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp
> index a96ca7f40cbd..fbadf350908a 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 + "/";
> }
>
> /**
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list