nacrypt 1.2.7

A secure and easy-to-use file encryption utility
Documentation
1
2
3
4
5
6
7
8
use anyhow::{Result, anyhow};
use dirs;

pub fn expand_tilde(path: &str) -> Result<String> {
    let home_dir = dirs::home_dir().ok_or_else(|| anyhow!("Failed to get home directory"))?;

    Ok(path.replacen("~", &home_dir.to_string_lossy(), 1))
}