Lines Matching +full:path +full:- +full:exists
7 use std::path::{Path, PathBuf};
10 fn exists<P: AsRef<Path>>(path: P) -> bool { in exists() function
11 std::fs::metadata(path.as_ref()).is_ok() in exists()
27 let path = tmpfile.path().to_path_buf(); in test_deleted() localVariable
28 assert!(exists(&path)); in test_deleted()
30 assert!(!exists(&path)); in test_deleted()
36 let old_path = tmpfile.path().to_path_buf(); in test_persist()
40 assert!(exists(&old_path)); in test_persist()
42 assert!(!exists(&old_path)); in test_persist()
52 // Try opening it at the new path. in test_persist()
65 let old_path = tmpfile.path().to_path_buf(); in test_persist_noclobber()
67 let persist_path = persist_target.path().to_path_buf(); in test_persist_noclobber()
69 assert!(exists(&old_path)); in test_persist_noclobber()
72 assert!(exists(&old_path)); in test_persist_noclobber()
77 // Try opening it at the new path. in test_persist_noclobber()
94 let name = tmpfile.path().file_name().unwrap().to_str().unwrap(); in test_customnamed()
129 let path = file.path().to_owned(); in test_into_file() localVariable
132 assert!(path.exists()); in test_into_file()
134 assert!(!path.exists()); in test_into_file()
157 let path = tmpfile.into_temp_path(); in test_temppath() localVariable
158 assert!(path.is_file()); in test_temppath()
172 assert!(exists(&old_path)); in test_temppath_persist()
174 assert!(!exists(&old_path)); in test_temppath_persist()
178 // Try opening it at the new path. in test_temppath_persist()
198 let persist_path = persist_target.path().to_path_buf(); in test_temppath_persist_noclobber()
200 assert!(exists(&old_path)); in test_temppath_persist_noclobber()
204 assert!(exists(&old_path)); in test_temppath_persist_noclobber()
211 // Try opening it at the new path. in test_temppath_persist_noclobber()
223 let tmp_file_path_1 = tmp_dir.path().join("testfile1"); in temp_path_from_existing()
224 let tmp_file_path_2 = tmp_dir.path().join("testfile2"); in temp_path_from_existing()
227 assert!(tmp_file_path_1.exists(), "Test file 1 hasn't been created"); in temp_path_from_existing()
230 assert!(tmp_file_path_2.exists(), "Test file 2 hasn't been created"); in temp_path_from_existing()
234 tmp_file_path_1.exists(), in temp_path_from_existing()
240 !tmp_file_path_1.exists(), in temp_path_from_existing()
241 "Test file exists after dropping TempPath" in temp_path_from_existing()
244 tmp_file_path_2.exists(), in temp_path_from_existing()
259 TempPath::from_path(Path::new("")); in temp_path_from_argument_types()
266 let path = NamedTempFile::new().unwrap().into_temp_path(); in test_write_after_close() localVariable
267 File::create(path).unwrap().write_all(b"test").unwrap(); in test_write_after_close()
274 let path = env::current_dir().unwrap().join(tmpfile.path()); in test_change_dir() localVariable
277 assert!(!exists(path)) in test_change_dir()
287 let path = temp_path.to_path_buf(); in test_into_parts() localVariable
289 assert!(path.exists()); in test_into_parts()
291 assert!(!path.exists()); in test_into_parts()
306 let path; in test_keep() localVariable
308 assert!(exists(&temp_path)); in test_keep()
309 path = temp_path.keep().unwrap(); in test_keep()
310 assert!(exists(&path)); in test_keep()
321 let mut f = File::open(&path).unwrap(); in test_keep()
327 std::fs::remove_file(&path).unwrap(); in test_keep()