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:
@@ -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 + "/";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user