Omit "./" at the start of the path (#109)

This commit is contained in:
TATSUNO Yasuhiro 2021-10-20 00:57:11 +09:00 committed by GitHub
parent 1337be4f49
commit 2e6cd893dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,7 @@
use std::{ use std::{
env, fs, env, fs,
io::{self, prelude::*}, io::{self, prelude::*},
path::Component,
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
@ -47,6 +48,7 @@ where
fs::create_dir_all(&path)?; fs::create_dir_all(&path)?;
} }
} }
let file_path = file_path.strip_prefix(Component::CurDir).unwrap_or_else(|_| file_path.as_path());
info!("{:?} extracted. ({})", file_path.display(), Bytes::new(file.size())); info!("{:?} extracted. ({})", file_path.display(), Bytes::new(file.size()));

View File

@ -2,6 +2,7 @@ use std::{
cmp, env, cmp, env,
ffi::OsStr, ffi::OsStr,
fs::{self, ReadDir}, fs::{self, ReadDir},
path::Component,
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
@ -45,6 +46,7 @@ pub fn user_wants_to_overwrite(path: &Path, flags: &oof::Flags) -> crate::Result
_ => {} _ => {}
} }
let path = path.strip_prefix(Component::CurDir).unwrap_or_else(|_| path);
Confirmation::new("Do you want to overwrite 'FILE'?", Some("FILE")).ask(Some(&to_utf(path))) Confirmation::new("Do you want to overwrite 'FILE'?", Some("FILE")).ask(Some(&to_utf(path)))
} }