[libcamera-devel] [PATCH] libcamera: utils: Identify the 'real' build path

Kieran Bingham kieran.bingham at ideasonboard.com
Wed Apr 29 17:45:25 CEST 2020


On 29/04/2020 16:42, Laurent Pinchart wrote:
> 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
> ? :-)
> 

Indeed ;-) - This makes the output much better and several levels of
/../../ on multiple prints for me.

>> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Thanks.

Kieran

> 
>> ---
>>  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
--
Kieran


More information about the libcamera-devel mailing list