asar coverage - build #207


src/asar/
File: src/asar/platform/windows/file-helpers-win32.cpp
Date: 2024-02-09 10:55:41
Lines:
10/10
100.0%
Functions:
4/4
100.0%
Branches:
7/10
70.0%

Line Branch Exec Source
1 // RPG Hacker: We can't include that here, because it leads to crazy
2 // errors in windows.h - probably related to our string class?!?
3 //#include "platform/file-helpers.h"
4
5 #if defined(_MSC_VER)
6 # pragma warning(push)
7 # pragma warning(disable : 4668)
8 # pragma warning(disable : 4987)
9 #endif
10
11 #include <windows.h>
12 #include <ctype.h>
13
14 #if defined(_MSC_VER)
15 # pragma warning(pop)
16 #endif
17
18 #include <ctype.h>
19
20 #include "../file-helpers.h"
21
22 783 bool file_exists(const char * filename)
23 {
24 783 return (GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES);
25 }
26
27 1384 bool path_is_absolute(const char* path)
28 {
29 2744 return ((isalpha(path[0]) &&
30
3/4
✓ Branch 0 taken 600 times.
✓ Branch 1 taken 760 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 600 times.
1360 (':' == path[1]) && (('\\' == path[2]) || ('/' == path[2]))) /* drive letter + root, e.g. C:\dir or C:/dir */
31
4/6
✓ Branch 0 taken 1360 times.
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 784 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 784 times.
2144 || ('\\' == path[0]) || ('/' == path[0])); /* just root, e.g. \dir or /dir */
32 }
33
34 23 char get_native_path_separator()
35 {
36 23 return '\\';
37 }
38
39 235 bool check_is_regular_file(const char* path)
40 {
41 235 return !(GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY);
42 }
43