* @brief Re-canonicalizes an opened path and confirms it still resolves within a root. */
| 179 | * @brief Re-canonicalizes an opened path and confirms it still resolves within a root. |
| 180 | */ |
| 181 | static bool openedPathWithinRoots(const QString& openedPath, const QStringList& roots) |
| 182 | { |
| 183 | const QFileInfo info(openedPath); |
| 184 | const auto canonical = info.canonicalFilePath(); |
| 185 | if (canonical.isEmpty()) |
| 186 | return false; |
| 187 | |
| 188 | for (const auto& root : roots) { |
| 189 | if (root.isEmpty()) |
| 190 | continue; |
| 191 | |
| 192 | if (canonical == root || canonical.startsWith(root + QLatin1Char('/'))) |
| 193 | return true; |
| 194 | } |
| 195 | |
| 196 | return false; |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * @brief Resolves an input path for reading against the workspace + dropped roots. |