Add utils::to_utf

This commit is contained in:
João M. Bezerra 2021-04-04 23:18:25 -03:00
parent 0c9131c307
commit b45f38f5fa

View File

@ -83,6 +83,11 @@ pub fn permission_for_overwriting(
Flags::None => {} Flags::None => {}
} }
let file_path_str = path.to_string_lossy(); let file_path_str = to_utf(path);
confirm.ask(Some(&file_path_str)) confirm.ask(Some(&file_path_str))
} }
pub fn to_utf(os_str: impl AsRef<OsStr>) -> String {
let text = format!("{:?}", os_str.as_ref());
text.trim_matches('"').to_string()
}