(path: &Path)
| 54 | } |
| 55 | |
| 56 | fn read_file(path: &Path) -> Option<String> { |
| 57 | match fs::read_to_string(path) { |
| 58 | Ok(content) => Some(content), |
| 59 | Err(e) => match e.kind() { |
| 60 | std::io::ErrorKind::NotFound => return None, |
| 61 | _ => { |
| 62 | // If the file exists, but we cannot read it (e.g. due to invalid permissions, etc.), |
| 63 | // we want to fail and let the user fix the issue. |
| 64 | panic!("Could not read file {} due to error: {}", path.display(), e); |
| 65 | } |
| 66 | }, |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | pub fn save_local_public_file(data_root_path: &Path, file_name: &String, contents: &String) { |
| 71 | create_directories_if_non_existent(data_root_path); |
no outgoing calls
no test coverage detected