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

openmc-dev / openmc / 9617074623

21 Jun 2024 04:53PM UTC coverage: 84.715% (+0.03%) from 84.688%
9617074623

Pull #3042

github

web-flow
Merge 47e50a3a9 into 4bd0b09e6
Pull Request #3042: Rely on std::filesystem for file_utils

26 of 31 new or added lines in 5 files covered. (83.87%)

921 existing lines in 34 files now uncovered.

48900 of 57723 relevant lines covered (84.71%)

31496763.14 hits per line

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

95.65
/src/file_utils.cpp
1
#include "openmc/file_utils.h"
2

3
#include <filesystem>
4

5
namespace openmc {
6

7
bool dir_exists(const std::string& path)
304✔
8
{
9
  std::filesystem::path d(path);
304✔
10
  return std::filesystem::is_directory(d);
608✔
11
}
304✔
12

13
bool file_exists(const std::string& filename)
4,966,050✔
14
{
15
  std::filesystem::path p(filename);
4,966,050✔
16
  if (!std::filesystem::exists(p)) {
4,966,050✔
17
    return false;
30,284✔
18
  }
19
  if (std::filesystem::is_directory(p)) {
4,935,766✔
NEW
20
    return false;
×
21
  }
22
  return true;
4,935,766✔
23
}
4,966,050✔
24

25
std::string dir_name(const std::string& filename)
79✔
26
{
27
  std::filesystem::path p(filename);
79✔
28
  return (p.parent_path()).string();
237✔
29
}
79✔
30

31
std::string get_file_extension(const std::string& filename)
7,231✔
32
{
33
  std::filesystem::path p(filename);
7,231✔
34
  auto ext = p.extension();
7,231✔
35
  if (!ext.empty()) {
7,231✔
36
    // path::extension includes the period
37
    return ext.string().substr(1);
14,390✔
38
  }
39
  return "";
36✔
40
}
7,231✔
41

42
} // namespace openmc
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc