From b45f38f5fad6f953edda3da3e6367c63c3909acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20M=2E=20Bezerra?= Date: Sun, 4 Apr 2021 23:18:25 -0300 Subject: [PATCH] Add utils::to_utf --- src/utils.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils.rs b/src/utils.rs index 4e8a565..98e260a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -83,6 +83,11 @@ pub fn permission_for_overwriting( Flags::None => {} } - let file_path_str = path.to_string_lossy(); + let file_path_str = to_utf(path); confirm.ask(Some(&file_path_str)) } + +pub fn to_utf(os_str: impl AsRef) -> String { + let text = format!("{:?}", os_str.as_ref()); + text.trim_matches('"').to_string() +}