| 2503 | #endif |
| 2504 | |
| 2505 | bool isAbsolutePath(const std::string &path) |
| 2506 | { |
| 2507 | #ifdef SIMPLECPP_WINDOWS |
| 2508 | // C:\\path\\file |
| 2509 | // C:/path/file |
| 2510 | if (path.length() >= 3 && std::isalpha(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/')) |
| 2511 | return true; |
| 2512 | |
| 2513 | // \\host\path\file |
| 2514 | // //host/path/file |
| 2515 | if (path.length() >= 2 && (path[0] == '\\' || path[0] == '/') && (path[1] == '\\' || path[1] == '/')) |
| 2516 | return true; |
| 2517 | |
| 2518 | return false; |
| 2519 | #else |
| 2520 | return !path.empty() && path[0] == '/'; |
| 2521 | #endif |
| 2522 | } |
| 2523 | } |
| 2524 | |
| 2525 | namespace simplecpp { |
no test coverage detected