* Whether an OS watcher event points at a file whose index metadata is still * current. Used on Windows to discard NTFS last-access notifications, which * libuv reports through fs.watch as ordinary change events (#1451).
(filePath: string)
| 2087 | * libuv reports through fs.watch as ordinary change events (#1451). |
| 2088 | */ |
| 2089 | private isIndexedFileStateCurrent(filePath: string): boolean { |
| 2090 | const tracked = this.queries.getFileByPath(filePath); |
| 2091 | if (!tracked) return false; |
| 2092 | |
| 2093 | try { |
| 2094 | const stat = fs.statSync(path.join(this.projectRoot, filePath)); |
| 2095 | return ( |
| 2096 | stat.isFile() && |
| 2097 | Number.isFinite(stat.mtimeMs) && |
| 2098 | Number.isFinite(tracked.modifiedAt) && |
| 2099 | stat.size === tracked.size && |
| 2100 | Math.floor(stat.mtimeMs) === Math.floor(tracked.modifiedAt) |
| 2101 | ); |
| 2102 | } catch { |
| 2103 | // Missing/inaccessible files must still reach sync so removals and |
| 2104 | // transient filesystem failures are reconciled rather than hidden. |
| 2105 | return false; |
| 2106 | } |
| 2107 | } |
| 2108 | |
| 2109 | /** |
| 2110 | * Start watching for file changes and auto-syncing. |
no test coverage detected