| 217 | // ---------------------------------------------------------------------------------------- |
| 218 | |
| 219 | bool directory:: |
| 220 | is_root_path ( |
| 221 | const std::string& path |
| 222 | ) const |
| 223 | { |
| 224 | using namespace std; |
| 225 | const char sep = get_separator(); |
| 226 | bool root_path = false; |
| 227 | if (path.size() > 2 && path[0] == sep && path[1] == sep) |
| 228 | { |
| 229 | // in this case this is a windows share path |
| 230 | string::size_type pos = path.find_first_of(sep,2); |
| 231 | if (pos != string::npos) |
| 232 | { |
| 233 | pos = path.find_first_of(sep,pos+1); |
| 234 | |
| 235 | if (pos == string::npos && path[path.size()-1] != sep) |
| 236 | root_path = true; |
| 237 | else if (pos == path.size()-1) |
| 238 | root_path = true; |
| 239 | } |
| 240 | |
| 241 | } |
| 242 | else if ( (path.size() == 2 || path.size() == 3) && path[1] == ':') |
| 243 | { |
| 244 | // if this is a valid windows path then it must be a root path |
| 245 | root_path = true; |
| 246 | } |
| 247 | |
| 248 | return root_path; |
| 249 | } |
| 250 | |
| 251 | // ---------------------------------------------------------------------------------------- |
| 252 | |