fix: populate ctime from platform-specific syscall data
All checks were successful
check / check (pull_request) Successful in 4m19s
All checks were successful
check / check (pull_request) Successful in 4m19s
The scanner was setting CTime to info.ModTime() as a placeholder since afero's FileInfo interface doesn't expose ctime directly. This change extracts the actual ctime from the underlying syscall.Stat_t via platform-specific build files: - macOS (Darwin): uses Birthtimespec (file creation/birth time) - Linux: uses Ctim (inode change time) - Other platforms: falls back to mtime Also adds: - Documentation of ctime semantics in README.md (new 'file metadata' section) - Platform differences table (macOS birth time vs Linux inode change time) - Note that ctime is recorded but not restored (not settable via standard APIs) - Updated README schema to match actual schema (adds ctime, source_path, link_target) - Doc comment on CTime field in database model closes #13
This commit is contained in:
@@ -728,7 +728,7 @@ func (s *Scanner) checkFileInMemory(path string, info os.FileInfo, knownFiles ma
|
||||
Path: types.FilePath(path),
|
||||
SourcePath: types.SourcePath(s.currentSourcePath), // Store source directory for restore path stripping
|
||||
MTime: info.ModTime(),
|
||||
CTime: info.ModTime(), // afero doesn't provide ctime
|
||||
CTime: getCTime(info),
|
||||
Size: info.Size(),
|
||||
Mode: uint32(info.Mode()),
|
||||
UID: uid,
|
||||
|
||||
Reference in New Issue
Block a user