Lines Matching refs:file_path

69     pub fn from_path(file_path: &Path, cache: &Cache) -> Result<Self> {  in from_path()
70 let metadata = fs::symlink_metadata(file_path)?; in from_path()
75 FileMetadata::from_symlink(file_path, &metadata) in from_path()
77 Ok(FileMetadata::from_file(file_path, &metadata, cache)?) in from_path()
84 pub fn from_symlink(file_path: &Path, metadata: &fs::Metadata) -> Result<Self> { in from_symlink()
85 let link = fs::read_link(file_path)?; in from_symlink()
101 pub fn from_file(file_path: &Path, metadata: &fs::Metadata, cache: &Cache) -> Result<Self> { in from_file()
108 let (digest, cache_key) = get_or_compute_digest(file_path, metadata, cache)?; in from_file()
213 .filter(|file_path| !is_special_file(file_path)) in fingerprint_partitions()
214 .map(|file_path| { in fingerprint_partitions()
216 file_path.strip_prefix(partition_root).unwrap().to_owned(), in fingerprint_partitions()
217 FileMetadata::from_path(&file_path, &cache).unwrap(), in fingerprint_partitions()
228 fn is_special_file(file_path: &Path) -> bool { in is_special_file()
231 let file_metadata = fs::symlink_metadata(file_path).expect("no metadata"); in is_special_file()
239 fn compute_digest(file_path: &Path) -> Result<String> { in compute_digest()
240 let input = fs::File::open(file_path)?; in compute_digest()
258 file_path: &Path, in get_or_compute_digest()
262 let cache_key = cache.cache_key(file_path, metadata)?; in get_or_compute_digest()
267 digest = compute_digest(file_path)?; in get_or_compute_digest()
288 pub fn cache_key(&self, file_path: &Path, metadata: &fs::Metadata) -> Result<String> { in cache_key()
291 file_path.display(), in cache_key()
301 pub fn read_from_file(file_path: &Path) -> Result<Self> { in read_from_file()
302 let mut file = fs::File::open(file_path)?; in read_from_file()
320 file_path: &Path, in write_to_file()
333 let mut file = fs::File::create(file_path)?; in write_to_file()
511 let file_path = tmpdir.path().join("empty_file"); in compute_digest_empty_file() localVariable
512 fs::write(&file_path, "").unwrap(); in compute_digest_empty_file()
515 compute_digest(&file_path).unwrap() in compute_digest_empty_file()
522 let file_path = tmpdir.path().join("small_file"); in compute_digest_small_file() localVariable
523 fs::write(&file_path, "This is a test\nof a small file.\n").unwrap(); in compute_digest_small_file()
526 compute_digest(&file_path).unwrap() in compute_digest_small_file()
533 let file_path = tmpdir.path().join("small_file"); in get_or_compute_digest_small_file() localVariable
534 fs::write(&file_path, "This is a test\nof a small file.\n").unwrap(); in get_or_compute_digest_small_file()
536 let metadata = fs::metadata(&file_path).expect("file metadata"); in get_or_compute_digest_small_file()
538 let (digest, cache_key) = get_or_compute_digest(&file_path, &metadata, &cache).unwrap(); in get_or_compute_digest_small_file()
547 file_path.display(), in get_or_compute_digest_small_file()
558 let (digest, _) = get_or_compute_digest(&file_path, &metadata, &cache).unwrap(); in get_or_compute_digest_small_file()
580 let file_path = tmpdir.path().join(num_bytes.to_string()); in verify_edge_case_digests() localVariable
581 fs::write(&file_path, &boring_buff[0..*num_bytes]).unwrap(); in verify_edge_case_digests()
583 compute_digest(&file_path).unwrap().starts_with(digest), in verify_edge_case_digests()
585 file_path, in verify_edge_case_digests()
594 let file_path = partition_root.path().join("small_file"); in fingerprint_file_for_file() localVariable
595 fs::write(&file_path, "This is a test\nof a small file.\n").unwrap(); in fingerprint_file_for_file()
599 let mut perms = fs::metadata(&file_path).expect("Getting permissions").permissions(); in fingerprint_file_for_file()
601 assert!(fs::set_permissions(&file_path, perms).is_ok()); in fingerprint_file_for_file()
603 let entry = FileMetadata::from_path(&file_path, &cache).unwrap(); in fingerprint_file_for_file()
620 let file_path = partition_root.path().join("small_file"); in fingerprint_file_for_relative_symlink() localVariable
621 fs::write(file_path, "This is a test\nof a small file.\n").unwrap(); in fingerprint_file_for_relative_symlink()
941 let file_path = tmp_root.path().join("system/file1.so"); in fingerprint_partition_cache_mismatch_test() localVariable
942 fs::write(file_path, "modified file.").unwrap(); in fingerprint_partition_cache_mismatch_test()
969 let file_path = root.path().join("cache.json"); in test_write_and_read_cache_file() localVariable
990 let write_result = cache.write_to_file(&results, &file_path); in test_write_and_read_cache_file()
993 let cache = Cache::read_from_file(&file_path).unwrap(); in test_write_and_read_cache_file()
1008 let file_path = root.path().join("cache.json"); in test_read_cache_file_invalid_file() localVariable
1009 fs::write(file_path.clone(), "invalid cache data").unwrap(); in test_read_cache_file_invalid_file()
1011 let cache = Cache::read_from_file(&file_path).unwrap_or_default(); in test_read_cache_file_invalid_file()