Message ID | 20200429151919.2341586-1-kieran.bingham@ideasonboard.com |
---|---|
State | Accepted |
Commit | 9e41dfbbffc59fab90aeb7bae34f2ca91c23b16e |
Headers | show |
Series |
|
Related | show |
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@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@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 + "/"; > } > > /**
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@ideasonboard.com> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@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 + "/"; >> } >> >> /** >
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 + "/"; } /**
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> --- src/libcamera/utils.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)