* Recursively rescans for new entries. * @param {string} dirPath The directory path * @param {string} relativePath The relative path from watched root
(dirPath, relativePath)
| 203 | * @param {string} relativePath The relative path from watched root |
| 204 | */ |
| 205 | #rescanRecursive(dirPath, relativePath) { |
| 206 | try { |
| 207 | const entries = this.#vfs.readdirSync(dirPath, { withFileTypes: true }); |
| 208 | for (const entry of entries) { |
| 209 | const fullPath = join(dirPath, entry.name); |
| 210 | const relPath = relativePath ? |
| 211 | join(relativePath, entry.name) : entry.name; |
| 212 | |
| 213 | if (entry.isDirectory()) { |
| 214 | this.#rescanRecursive(fullPath, relPath); |
| 215 | } else if (!this.#trackedFiles.has(fullPath)) { |
| 216 | const stats = this.#getStatsFor(fullPath); |
| 217 | this.#trackedFiles.set(fullPath, { |
| 218 | stats, |
| 219 | relativePath: relPath, |
| 220 | }); |
| 221 | this.emit('change', 'rename', this.#encodeFilename(relPath)); |
| 222 | } |
| 223 | } |
| 224 | } catch { |
| 225 | // Directory might not exist or be readable |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Gets stats for a specific path. |
no test coverage detected