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>
This commit is contained in:
Kieran Bingham 2020-04-28 13:12:24 +01:00
parent 389c19c267
commit 9e41dfbbff

View file

@ -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 + "/";
}
/**