| 164 | } |
| 165 | |
| 166 | bool Path_IsAbsolute( const std::string & sPath ) |
| 167 | { |
| 168 | if( sPath.empty() ) |
| 169 | return false; |
| 170 | |
| 171 | #if defined( WIN32 ) |
| 172 | if ( sPath.size() < 3 ) // must be c:\x or \\x at least |
| 173 | return false; |
| 174 | |
| 175 | if ( sPath[1] == ':' ) // drive letter plus slash, but must test both slash cases |
| 176 | { |
| 177 | if ( sPath[2] == '\\' || sPath[2] == '/' ) |
| 178 | return true; |
| 179 | } |
| 180 | else if ( sPath[0] == '\\' && sPath[1] == '\\' ) // UNC path |
| 181 | return true; |
| 182 | #else |
| 183 | if( sPath[0] == '\\' || sPath[0] == '/' ) // any leading slash |
| 184 | return true; |
| 185 | #endif |
| 186 | |
| 187 | return false; |
| 188 | } |
| 189 | |
| 190 | |
| 191 | /** Makes an absolute path from a relative path and a base path */ |
no test coverage detected