LCOV - code coverage report
Current view: top level - libs/testitall/src - check_file_exists.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 87.5 % 8 7
Test Date: 2026-01-12 05:34:38 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /**
       2              :  * @file check_file_exists.c
       3              :  * @brief File existence verification functionality
       4              :  */
       5              : 
       6              : #include "testitall.h"
       7              : 
       8              : /**
       9              :  * @brief Checks if a file exists
      10              :  *
      11              :  * @param[out] file_exists Pointer that will be set to true when the file exists, false otherwise
      12              :  * @param[in]  filename    Path to the file to check
      13              :  *
      14              :  * @return Return status indicating the result of operation:
      15              :  *         - SUCCESS after a successful check (even when the file is absent)
      16              :  *         - FAILURE when filename is NULL
      17              :  */
      18            3 : Return check_file_exists(
      19              :         bool       *file_exists,
      20              :         const char *filename)
      21              : {
      22            3 :         Return status = SUCCESS;
      23              : 
      24            3 :         *file_exists = false;
      25              : 
      26            3 :         if(NULL == filename)
      27              :         {
      28            0 :                 return(FAILURE);
      29              :         }
      30              : 
      31            3 :         if(0 == access(filename,F_OK))
      32              :         {
      33            1 :                 *file_exists = true;
      34              :         }
      35              : 
      36            3 :         return(status);
      37              : }
        

Generated by: LCOV version 2.0-1