asar coverage - build #214


src/asar/
File: src/asar/platform/linux/file-helpers-linux.cpp
Date: 2024-02-26 14:37:12
Lines:
13/13
100.0%
Functions:
4/4
100.0%
Branches:
3/4
75.0%

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