1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use std::io;
use std::path::Path;
use tc_error::*;
use tcgeneric::{label, Label};
pub use block::*;
pub use dir::*;
pub use file::*;
mod block;
mod dir;
#[allow(unused)]
mod file;
const VERSION: Label = label(".version");
#[inline]
fn file_ext(path: &'_ Path) -> Option<&'_ str> {
path.extension().and_then(|ext| ext.to_str())
}
pub(crate) fn io_err(err: io::Error) -> TCError {
match err.kind() {
io::ErrorKind::NotFound => TCError::not_found(err),
io::ErrorKind::PermissionDenied => TCError::internal(format!(
"TinyChain does not have permission to access the host filesystem: {}",
err
)),
_ => TCError::internal(format!("host filesystem error: {}", err)),
}
}