| 174 | } |
| 175 | |
| 176 | bool Path::isAbsolute(const std::string& path) |
| 177 | { |
| 178 | #ifdef _WIN32 |
| 179 | if (path.length() < 2) |
| 180 | return false; |
| 181 | |
| 182 | if ((path[0] == '\\' || path[0] == '/') && (path[1] == '\\' || path[1] == '/')) |
| 183 | return true; |
| 184 | |
| 185 | // On Windows, 'C:\foo\bar' is an absolute path, while 'C:foo\bar' is not |
| 186 | return std::isalpha(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/'); |
| 187 | #else |
| 188 | return !path.empty() && path[0] == '/'; |
| 189 | #endif |
| 190 | } |
| 191 | |
| 192 | bool Path::isRelative(const std::string& path) |
| 193 | { |
no test coverage detected