| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "Tools.h" | ||
| 2 | #include <stdexcept> | ||
| 3 | |||
| 4 | namespace iguana::tools { | ||
| 5 | |||
| 6 |
2/2✓ Branch 2 → 3 taken 94 times.
✓ Branch 2 → 6 taken 25 times.
|
119 | std::string ExpandTilde(std::string const& path) |
| 7 | { | ||
| 8 |
3/4✓ Branch 2 → 3 taken 94 times.
✓ Branch 2 → 6 taken 25 times.
✓ Branch 5 → 6 taken 94 times.
✗ Branch 5 → 7 not taken.
|
213 | if(path.empty() || path[0] != '~') |
| 9 | return path; | ||
| 10 | ✗ | if(char const* home_dir = std::getenv("HOME"); home_dir) | |
| 11 | ✗ | return std::string(home_dir) + path.substr(1); | |
| 12 | ✗ | throw std::runtime_error("cannot expand `~` since $HOME is not set"); | |
| 13 | } | ||
| 14 | |||
| 15 | } | ||
| 16 |