[{"id":25627,"web_url":"https://patchwork.libcamera.org/comment/25627/","msgid":"<20221027164316.n5et67wntgpbolvh@uno.localdomain>","date":"2022-10-27T16:43:16","subject":"Re: [libcamera-devel] [PATCH 05/10] android: remove references to\n\tstd::filesystem","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"On Thu, Oct 27, 2022 at 12:55:10AM -0500, Nicholas Roth via libcamera-devel wrote:\n> From: Nicholas Roth <nicholas@rothemail.net>\n>\n> Android 11's toolchain does not support std::filesystem, but\n> camera_hal_config.cpp currently uses it. Remove references to\n> std::filesystem in order to support Android <= 11.\n>\n> This adds a very small difference in behaviour, as File::exist() will\n> return true for special files (pipes, character or block devices, ...)\n> while std::filesystem::is_regular_file() doesn't, but I consider this\n> to be a corner case that doesn't matter much.\n>\n\nI think we can live with this, yes\n\n> Signed-off-by: Nicholas Roth <nicholas@rothemail.net>\n> ---\n>  src/android/camera_hal_config.cpp | 11 +++++------\n>  1 file changed, 5 insertions(+), 6 deletions(-)\n>\n> diff --git a/src/android/camera_hal_config.cpp b/src/android/camera_hal_config.cpp\n> index bacfe4b9..6fd71162 100644\n> --- a/src/android/camera_hal_config.cpp\n> +++ b/src/android/camera_hal_config.cpp\n> @@ -6,7 +6,6 @@\n>   */\n>  #include \"camera_hal_config.h\"\n>\n> -#include <filesystem>\n>  #include <stdlib.h>\n>  #include <string>\n>\n> @@ -160,15 +159,15 @@ CameraHalConfig::CameraHalConfig()\n>   */\n>  int CameraHalConfig::parseConfigurationFile()\n>  {\n> -\tstd::filesystem::path filePath = LIBCAMERA_SYSCONF_DIR;\n> -\tfilePath /= \"camera_hal.yaml\";\n> -\tif (!std::filesystem::is_regular_file(filePath)) {\n> +\tstd::string filePath = LIBCAMERA_SYSCONF_DIR \"/camera_hal.yaml\";\n> +\n> +\tFile file(filePath);\n> +\tif (!file.exists()) {\n>  \t\tLOG(HALConfig, Debug)\n> -\t\t\t<< \"Configuration file: \\\"\" << filePath << \"\\\" not found\";\n> +\t\t\t\t\t<< \"Configuration file: \\\"\" << filePath << \"\\\" not found\";\n\nI would not change the indentation.\n\nThis apart:\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nI'm surprised this is the only place where we use std::filesystem!\n\n>  \t\treturn -ENOENT;\n>  \t}\n>\n> -\tFile file(filePath);\n>  \tif (!file.open(File::OpenModeFlag::ReadOnly)) {\n>  \t\tint ret = file.error();\n>  \t\tLOG(HALConfig, Error) << \"Failed to open configuration file \"\n> --\n> 2.34.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F09B7BDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 27 Oct 2022 16:43:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 39AAE62F9C;\n\tThu, 27 Oct 2022 18:43:20 +0200 (CEST)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 03C6062F89\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Oct 2022 18:43:18 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 4B939240005;\n\tThu, 27 Oct 2022 16:43:17 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666889000;\n\tbh=9dLY88hnj7w2vRLU/bQYBmL+UX2Qk1krHGhpRQ2vNLM=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=4WCIyUU7xAopNqO+aQl1qI0kv04VHER/ZKy2Fuz+wGMO5YmmfKpUKo70Qul5bpgzu\n\tHftCqQmfOSXEbDs/1/PHquAUfWKijJwWrYieW2BdD0BlI77Ho0/87E60xpGYzwu8XZ\n\t18s0NuiJhA1zsAAKKdY50AMwiv1SLT2pmta3W68eJfPt5pLan5juvN+DV7690Cxm+A\n\ttKx8QIz1s5Ie1uRu8qIu5adHKhF3gIU8qH3+g9rsnrUg/KAQWmTVUTu+hapamMzbS3\n\tvvQ/gGHWgAPk58HYdA1t/mitQZhFkWoZliriJK6ibpalSLb6dsKufConLNU7W0Zwr9\n\tvL8jaEU14+jXQ==","Date":"Thu, 27 Oct 2022 18:43:16 +0200","To":"Nicholas Roth via libcamera-devel <libcamera-devel@lists.libcamera.org>","Message-ID":"<20221027164316.n5et67wntgpbolvh@uno.localdomain>","References":"<libcamera Android Enhancements>\n\t<20221027055515.321791-1-nicholas@rothemail.net>\n\t<20221027055515.321791-6-nicholas@rothemail.net>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20221027055515.321791-6-nicholas@rothemail.net>","Subject":"Re: [libcamera-devel] [PATCH 05/10] android: remove references to\n\tstd::filesystem","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"nicholas@rothemail.net","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]