mirror of
https://github.com/mistricky/codesnap.nvim.git
synced 2025-01-03 15:37:29 -08:00
10 lines
282 B
Rust
10 lines
282 B
Rust
use regex::Regex;
|
|
use std::env::{var, VarError};
|
|
|
|
pub fn parse_save_path(path: String) -> Result<String, VarError> {
|
|
let home_path = var("HOME")?;
|
|
let regex = Regex::new(r"(~|$HOME)").unwrap();
|
|
let path = regex.replace_all(&path, home_path);
|
|
|
|
Ok(path.to_string())
|
|
}
|