Directory: | ./ |
---|---|
File: | Core/filesystemUtil.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 9 | 9 | 100.0% |
Branches: | 6 | 12 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // ______ ______ _ _ _____ ______ | ||
2 | // | ____| ____| | (_)/ ____| | ____| | ||
3 | // | |__ | |__ | | _| (___ ___| |__ | ||
4 | // | __| | __| | | | |\___ \ / __| __| | ||
5 | // | | | |____| |____| |____) | (__| |____ | ||
6 | // |_| |______|______|_|_____/ \___|______| | ||
7 | // Finite Elements for Life Sciences and Engineering | ||
8 | // | ||
9 | // License: LGL2.1 License | ||
10 | // FELiScE default license: LICENSE in root folder | ||
11 | // | ||
12 | // Main authors: Vicente Mataix Ferrandiz | ||
13 | // | ||
14 | |||
15 | // System includes | ||
16 | |||
17 | // External includes | ||
18 | |||
19 | // Project includes | ||
20 | #include "Core/filesystemUtil.hpp" | ||
21 | |||
22 | namespace felisce { | ||
23 | namespace filesystemUtil { | ||
24 | |||
25 | 1399 | bool directoryExists(const char *path) | |
26 | { | ||
27 |
1/2✓ Branch 2 taken 1399 times.
✗ Branch 3 not taken.
|
1399 | const std::string string_path(path); |
28 |
2/4✓ Branch 1 taken 1399 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1399 times.
✗ Branch 5 not taken.
|
2798 | return std::filesystem::exists(string_path); |
29 | 1399 | } | |
30 | |||
31 | /***********************************************************************************/ | ||
32 | /***********************************************************************************/ | ||
33 | |||
34 | 18 | bool fileExists (const std::string& name) | |
35 | { | ||
36 |
1/2✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
18 | return std::filesystem::exists(name); |
37 | } | ||
38 | |||
39 | /***********************************************************************************/ | ||
40 | /***********************************************************************************/ | ||
41 | |||
42 | 13 | void copyFileSomewhereElse( | |
43 | const std::string& inFileName, | ||
44 | const std::string& outFileName | ||
45 | ) | ||
46 | { | ||
47 |
2/4✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 13 times.
✗ Branch 6 not taken.
|
13 | std::filesystem::copy_file(inFileName, outFileName, std::filesystem::copy_options::update_existing); |
48 | 13 | } | |
49 | |||
50 | } | ||
51 | } | ||
52 |