• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wirenboard / wb-mqtt-w1 / 50

31 Jul 2026 10:39AM UTC coverage: 61.341% (-0.5%) from 61.795%
50

push

github

web-flow
Use exported vars instead of MAKEFLAGS for coverage options (#36)

172 of 248 branches covered (69.35%)

311 of 507 relevant lines covered (61.34%)

4.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.17
/file_utils.cpp
1
#include "file_utils.h"
2

3
#include <cstring>
4
#include <dirent.h>
5
#include <filesystem>
6
#include <iomanip>
7

8
TNoDirError::TNoDirError(const std::string& msg): std::runtime_error(msg)
×
9
{}
×
10

11
bool TryOpen(const std::vector<std::string>& fnames, std::ifstream& file)
×
12
{
13
    for (auto& fname: fnames) {
×
14
        file.open(fname);
×
15
        if (file.is_open()) {
×
16
            return true;
×
17
        }
18
        file.clear();
×
19
    }
20
    return false;
×
21
}
22

23
void WriteToFile(const std::string& fileName, const std::string& value)
×
24
{
25
    std::ofstream f;
×
26
    OpenWithException(f, fileName);
×
27
    f << value;
×
28
}
×
29

30
void IterateDir(const std::string& dirName, std::function<bool(const std::string&)> fn)
20✔
31
{
32
    try {
33
        const std::filesystem::path dirPath{dirName};
20✔
34

35
        for (const auto& entry: std::filesystem::directory_iterator(dirPath)) {
45✔
36
            const auto filenameStr = entry.path().filename().string();
25✔
37
            if (fn(filenameStr)) {
25✔
38
                return;
×
39
            }
40
        }
45✔
41
    } catch (std::filesystem::filesystem_error const& ex) {
20✔
42
        throw TNoDirError(ex.what());
×
43
    }
×
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc