MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / file_state

Function file_state

atomic-cli/src/commands/diagnostics/collect.rs:914–923  ·  view source on GitHub ↗
(path: &Path, recorded_blake3: &str)

Source from the content-addressed store, hash-verified

912}
913
914fn file_state(path: &Path, recorded_blake3: &str) -> FileState {
915 match std::fs::read(path) {
916 Ok(bytes) if blake3::hash(&bytes).to_hex().as_str() == recorded_blake3 => {
917 FileState::Present
918 }
919 Ok(_) => FileState::Modified,
920 Err(error) if error.kind() == ErrorKind::NotFound => FileState::Missing,
921 Err(_) => FileState::Unreadable,
922 }
923}
924
925/// Whether a settings file still carries this integration's hook commands.
926#[derive(Debug)]

Callers 1

collect_fromFunction · 0.85

Calls 5

readFunction · 0.50
hashFunction · 0.50
as_strMethod · 0.45
to_hexMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected