| 378 | } |
| 379 | } |
| 380 | inline std::string path_join(std::string p1, std::string p2) { |
| 381 | #ifdef _WIN32 |
| 382 | char sep = '\\'; |
| 383 | #else |
| 384 | char sep = '/'; |
| 385 | #endif |
| 386 | if (p1.size() && p2.size() && p2[0] == sep) { |
| 387 | throw std::invalid_argument("Cannot join to absolute path"); |
| 388 | } |
| 389 | if (p1.size() && p1[p1.size() - 1] != sep) { |
| 390 | p1 += sep; |
| 391 | } |
| 392 | return p1 + p2; |
| 393 | } |
| 394 | // Elides "/." and "/.." tokens from path. |
| 395 | inline std::string path_simplify(const std::string& path) { |
| 396 | std::vector<std::string> dirs; |
no outgoing calls
no test coverage detected