mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Omit "./" at the start of the path (#109)
This commit is contained in:
parent
1337be4f49
commit
2e6cd893dc
@ -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()));
|
||||||
|
|
||||||
|
@ -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)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user