subplot 0.2.0

tools for specifying, documenting, and implementing automated acceptance tests for systems and software
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::{Result, SubplotError};

use std::path::{Path, PathBuf};

/// Get the base directory given the name of the markdown file.
///
/// All relative filename, such as bindings files, are resolved
/// against the base directory.
pub fn get_basedir_from(filename: &Path) -> Result<PathBuf> {
    let dirname = match filename.parent() {
        None => return Err(SubplotError::BasedirError(filename.to_path_buf())),
        Some(x) => x.to_path_buf(),
    };
    Ok(dirname)
}