mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 11:35:45 +00:00
Merge pull request #229 from sigmaSd/ux
Actually use relative paths when extracting
This commit is contained in:
commit
35a158ec63
@ -38,7 +38,8 @@ pub fn unpack_archive(
|
||||
// importance for most users, but would generate lots of
|
||||
// spoken text for users using screen readers, braille displays
|
||||
// and so on
|
||||
info!(@display_handle, inaccessible, "{:?} extracted. ({})", output_folder.join(file.path()?), Bytes::new(file.size()));
|
||||
|
||||
info!(@display_handle, inaccessible, "{:?} extracted. ({})", utils::strip_cur_dir(&output_folder.join(file.path()?)), Bytes::new(file.size()));
|
||||
|
||||
files_unpacked.push(file_path);
|
||||
}
|
||||
|
@ -1,9 +1,4 @@
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
cmp,
|
||||
ffi::OsStr,
|
||||
path::{Component, Path},
|
||||
};
|
||||
use std::{borrow::Cow, cmp, ffi::OsStr, path::Path};
|
||||
|
||||
/// Converts an OsStr to utf8 with custom formatting.
|
||||
///
|
||||
@ -19,7 +14,8 @@ pub fn to_utf(os_str: impl AsRef<OsStr>) -> String {
|
||||
/// normally used for presentation sake.
|
||||
/// If this function fails, it will return source path as a PathBuf.
|
||||
pub fn strip_cur_dir(source_path: &Path) -> &Path {
|
||||
source_path.strip_prefix(Component::CurDir).unwrap_or(source_path)
|
||||
let cwd = std::env::current_dir().unwrap_or_else(|_| Path::new(".").to_path_buf());
|
||||
source_path.strip_prefix(cwd).unwrap_or(source_path)
|
||||
}
|
||||
|
||||
/// Converts a slice of AsRef<OsStr> to comma separated String
|
||||
|
Loading…
x
Reference in New Issue
Block a user