thot-cli 0.10.0-intermediate

Command line interface (CLI) for Thot data management and analysis software.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::result::Result;
use std::env;
use std::path::PathBuf;
use thot_local::common::canonicalize_path;

/// Returns the absolute version of the path, relative to the current directory, if path is relative.
pub fn abs_path(path: PathBuf) -> Result<PathBuf> {
    let mut path = path;
    if path.is_relative() {
        let cwd = env::current_dir()?;
        path = cwd.join(path);
    };

    path = canonicalize_path(path)?;
    Ok(path)
}