* 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)
| 2082 | * libuv reports through fs.watch as ordinary change events (#1451). |
| 2083 | */ |
| 2084 | private isIndexedFileStateCurrent(filePath: string): boolean { |
| 2085 | const tracked = this.queries.getFileByPath(filePath); |
| 2086 | if (!tracked) return false; |
| 2087 | |
| 2088 | try { |
| 2089 | const stat = fs.statSync(path.join(this.projectRoot, filePath)); |
| 2090 | return ( |
| 2091 | stat.isFile() && |
| 2092 | Number.isFinite(stat.mtimeMs) && |
| 2093 | Number.isFinite(tracked.modifiedAt) && |
| 2094 | stat.size === tracked.size && |
| 2095 | Math.floor(stat.mtimeMs) === Math.floor(tracked.modifiedAt) |
| 2096 | ); |
| 2097 | } catch { |
| 2098 | // Missing/inaccessible files must still reach sync so removals and |
| 2099 | // transient filesystem failures are reconciled rather than hidden. |
| 2100 | return false; |
| 2101 | } |
| 2102 | } |
| 2103 | |
| 2104 | /** |
| 2105 | * Start watching for file changes and auto-syncing. |
no test coverage detected