Makelore 2.0 initial clean snapshot

This commit is contained in:
inman
2026-07-29 17:22:35 +08:00
commit b8ca3f8eea
694 changed files with 139782 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import { statSync } from 'node:fs';
export interface ExecutableSnapshot {
dev: number;
ino: number;
mtimeMs: number;
size: number;
}
export function snapshotExecutable(execPath: string): ExecutableSnapshot | null {
try {
const stat = statSync(execPath);
return {
dev: stat.dev,
ino: stat.ino,
mtimeMs: stat.mtimeMs,
size: stat.size,
};
} catch {
return null;
}
}
export function executableSnapshotChanged(
initial: ExecutableSnapshot | null,
current: ExecutableSnapshot | null,
): boolean {
if (!initial || !current) {
return false;
}
return (
initial.dev !== current.dev
|| initial.ino !== current.ino
|| initial.mtimeMs !== current.mtimeMs
|| initial.size !== current.size
);
}