LCOV - code coverage report
Current view: top level - asar/platform/linux - file-helpers-linux.cpp (source / functions) Coverage Total Hit
Test: asar.info Lines: 100.0 % 10 10
Test Date: 2024-01-15 16:23:49 Functions: 100.0 % 4 4
Branches: 75.0 % 4 3

             Branch data     Line data    Source code
       1                 :             : #include "platform/file-helpers.h"
       2                 :             : #include <sys/stat.h>
       3                 :             : 
       4                 :         768 : bool file_exists(const char * filename)
       5                 :             : {
       6                 :             :         struct stat st;
       7                 :         768 :         return (!stat(filename, &st));
       8                 :             : }
       9                 :             : 
      10                 :        1354 : bool path_is_absolute(const char* path)
      11                 :             : {
      12                 :        1354 :         return ('/' == path[0]);
      13                 :             : }
      14                 :             : 
      15                 :          23 : char get_native_path_separator()
      16                 :             : {
      17                 :          23 :         return '/';
      18                 :             : }
      19                 :             : 
      20                 :         225 : bool check_is_regular_file(const char* path)
      21                 :             : {
      22                 :             :         struct stat finfo;
      23         [ +  - ]:         225 :         if (stat(path, &finfo) == 0)
      24                 :             :         {
      25                 :             :                 // either regular file or symlink
      26         [ +  + ]:         225 :                 if (finfo.st_mode & (S_IFREG | S_IFLNK))
      27                 :         222 :                         return true;
      28                 :             :         }
      29                 :             :         return false;
      30                 :             : }
        

Generated by: LCOV version 2.0-1