From patchwork Wed Apr 29 15:19:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 3611 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 43F1F609D6 for ; Wed, 29 Apr 2020 17:19:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="VwXeCuQP"; dkim-atps=neutral Received: from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C75BF521; Wed, 29 Apr 2020 17:19:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1588173564; bh=vAKKadpXiRlxLrwi7FH0x1NYtsIDfKCUwpyehNONQ4Y=; h=From:To:Cc:Subject:Date:From; b=VwXeCuQPahJ2m0aYKVqhh1W5WK2EIUNo1ggR5LHcWbv8zSaFmxgV5TWWwOKLCPIfp Fgjpj6nBFSmysm7eBsONsBpSKHKotzIwnPybqb29zsBB9616/LY+eTyVOMCc/u8DW+ 4rzeuBzoSKjLS4qRVxu0w3bjGpB1WiAn0r8Fz51U= From: Kieran Bingham To: libcamera devel Date: Wed, 29 Apr 2020 16:19:19 +0100 Message-Id: <20200429151919.2341586-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: utils: Identify the 'real' build path X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 15:19:25 -0000 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 Reviewed-by: Laurent Pinchart --- 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 + "/"; } /**