36 lines
941 B
Rust
36 lines
941 B
Rust
//! Utilities asserting that the data being worked on is sound and well formatted.
|
||
//!
|
||
//! This module provides simple helpers that validate file system paths.
|
||
//!
|
||
//!
|
||
|
||
use std::path::Path;
|
||
|
||
use crate::error::EpochError;
|
||
|
||
/// Check whether `path` points to a valid Epoch directory.
|
||
///
|
||
/// A *valid* directory is one that satisfies the expectations of the `epoch` format.
|
||
#[deprecated]
|
||
pub fn is_a_epoch_directory(path: &Path) -> Result<(), EpochError> {
|
||
let dir = path.read_dir().map_err(|_e| {
|
||
EpochError::MainFolderInvalid(path.to_str().unwrap_or_default().to_owned())
|
||
})?;
|
||
for e in dir.flatten() {
|
||
println!("{:?}", e.file_name());
|
||
}
|
||
Ok(())
|
||
}
|
||
|
||
/// Validate that the configuration file at `path` is well‑formed.
|
||
pub fn is_config_well_formated(_path: &Path) -> Result<(), EpochError> {
|
||
Ok(())
|
||
}
|
||
|
||
#[cfg(test)]
|
||
mod test {
|
||
#![allow(dead_code)]
|
||
fn test_directory() {}
|
||
fn test_config() {}
|
||
}
|