| 402 | } |
| 403 | |
| 404 | Path Path::parent() const |
| 405 | { |
| 406 | if (m_data.isEmpty()) { |
| 407 | return Path(); |
| 408 | } |
| 409 | |
| 410 | Path ret(*this); |
| 411 | if (m_data.size() == (1 + (isRemote() ? 1 : 0))) { |
| 412 | // keep the root item, but clear it, otherwise we'd make the path invalid |
| 413 | // or a URL a local path |
| 414 | auto& root = ret.m_data.last(); |
| 415 | if (!isWindowsDriveLetter(root)) { |
| 416 | root.clear(); |
| 417 | } |
| 418 | } else { |
| 419 | ret.m_data.pop_back(); |
| 420 | } |
| 421 | return ret; |
| 422 | } |
| 423 | |
| 424 | bool Path::hasParent() const |
| 425 | { |