* 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)
| 2031 | * libuv reports through fs.watch as ordinary change events (#1451). |
| 2032 | */ |
| 2033 | private isIndexedFileStateCurrent(filePath: string): boolean { |
| 2034 | const tracked = this.queries.getFileByPath(filePath); |
| 2035 | if (!tracked) return false; |
| 2036 | |
| 2037 | try { |
| 2038 | const stat = fs.statSync(path.join(this.projectRoot, filePath)); |
| 2039 | return ( |
| 2040 | stat.isFile() && |
| 2041 | Number.isFinite(stat.mtimeMs) && |
| 2042 | Number.isFinite(tracked.modifiedAt) && |
| 2043 | stat.size === tracked.size && |
| 2044 | Math.floor(stat.mtimeMs) === Math.floor(tracked.modifiedAt) |
| 2045 | ); |
| 2046 | } catch { |
| 2047 | // Missing/inaccessible files must still reach sync so removals and |
| 2048 | // transient filesystem failures are reconciled rather than hidden. |
| 2049 | return false; |
| 2050 | } |
| 2051 | } |
| 2052 | |
| 2053 | /** |
| 2054 | * Start watching for file changes and auto-syncing. |
no test coverage detected