try fixing #132 by using shellexpand-utils

https://todo.sr.ht/~soywod/pimalaya/132
This commit is contained in:
Clément DOUIN
2023-08-29 11:28:20 +02:00
parent 606162452e
commit 4b60379070
3 changed files with 40 additions and 16 deletions
+4 -3
View File
@@ -3,7 +3,8 @@ use crate::account;
use anyhow::Result;
use dialoguer::{theme::ColorfulTheme, Confirm, Input, Password, Select};
use once_cell::sync::Lazy;
use std::{env, fs, io, path::PathBuf, process};
use shellexpand_utils::{shellexpand_path, try_shellexpand_path};
use std::{env, fs, io, process};
#[macro_export]
macro_rules! wizard_warn {
@@ -92,9 +93,9 @@ pub(crate) async fn configure() -> Result<DeserializedConfig> {
.to_string_lossy()
.to_string(),
)
.validate_with(|path: &String| shellexpand::full(path).map(|_| ()))
.validate_with(|path: &String| try_shellexpand_path(path).map(|_| ()))
.interact()?;
let path: PathBuf = shellexpand::full(&path).unwrap().to_string().into();
let path = shellexpand_path(&path);
println!("Writing the configuration to {path:?}");