| 376 | } |
| 377 | |
| 378 | void Path::addPath(const QString& path) |
| 379 | { |
| 380 | if (path.isEmpty()) { |
| 381 | return; |
| 382 | } |
| 383 | |
| 384 | const auto& newData = splitPath(path); |
| 385 | if (newData.isEmpty()) { |
| 386 | if (m_data.size() == (isRemote() ? 1 : 0)) { |
| 387 | // this represents the root path, we just turned an invalid path into it |
| 388 | m_data << QString(); |
| 389 | } |
| 390 | return; |
| 391 | } |
| 392 | |
| 393 | auto it = newData.begin(); |
| 394 | if (!m_data.isEmpty() && m_data.last().isEmpty()) { |
| 395 | // the root item is empty, set its contents and continue appending |
| 396 | m_data.last() = *it; |
| 397 | ++it; |
| 398 | } |
| 399 | |
| 400 | std::copy(it, newData.end(), std::back_inserter(m_data)); |
| 401 | cleanPath(&m_data, isRemote()); |
| 402 | } |
| 403 | |
| 404 | Path Path::parent() const |
| 405 | { |