mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Compile on stable
This commit is contained in:
parent
34c09d5d69
commit
734ffd4331
@ -93,7 +93,7 @@ where
|
||||
let mut file = match fs::File::open(path) {
|
||||
Ok(f) => f,
|
||||
Err(e) => {
|
||||
if e.kind() == std::io::ErrorKind::NotFound && path.is_symlink() {
|
||||
if e.kind() == std::io::ErrorKind::NotFound && utils::is_symlink(path) {
|
||||
// This path is for a broken symlink
|
||||
// We just ignore it
|
||||
continue;
|
||||
|
@ -15,8 +15,8 @@ use crate::{
|
||||
info,
|
||||
list::FileInArchive,
|
||||
utils::{
|
||||
cd_into_same_dir_as, concatenate_os_str_list, dir_is_empty, get_invalid_utf8_paths, strip_cur_dir, to_utf,
|
||||
Bytes,
|
||||
self, cd_into_same_dir_as, concatenate_os_str_list, dir_is_empty, get_invalid_utf8_paths, strip_cur_dir,
|
||||
to_utf, Bytes,
|
||||
},
|
||||
};
|
||||
|
||||
@ -145,7 +145,7 @@ where
|
||||
let file_bytes = match fs::read(entry.path()) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
if e.kind() == std::io::ErrorKind::NotFound && path.is_symlink() {
|
||||
if e.kind() == std::io::ErrorKind::NotFound && utils::is_symlink(path) {
|
||||
// This path is for a broken symlink
|
||||
// We just ignore it
|
||||
continue;
|
||||
|
@ -5,8 +5,6 @@
|
||||
// used as a binary. Since `clap` doesn't remove URL markup in it's help output,
|
||||
// we don't mark them as URLs. This suppresses the relevant rustdoc warning:
|
||||
#![allow(rustdoc::bare_urls)]
|
||||
// Useful to detect broken symlinks when compressing. (So we can safely ignore them)
|
||||
#![feature(is_symlink)]
|
||||
|
||||
// Macros should be declared before
|
||||
pub mod macros;
|
||||
|
@ -119,3 +119,10 @@ pub fn try_infer_extension(path: &Path) -> Option<Extension> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if a path is a symlink.
|
||||
/// This is the same as the nightly https://doc.rust-lang.org/std/path/struct.Path.html#method.is_symlink
|
||||
// Useful to detect broken symlinks when compressing. (So we can safely ignore them)
|
||||
pub fn is_symlink(path: &Path) -> bool {
|
||||
fs::symlink_metadata(path).map(|m| m.file_type().is_symlink()).unwrap_or(false)
|
||||
}
|
||||
|
@ -9,7 +9,9 @@ mod fs;
|
||||
mod question;
|
||||
|
||||
pub use formatting::{concatenate_os_str_list, nice_directory_display, strip_cur_dir, to_utf, Bytes};
|
||||
pub use fs::{cd_into_same_dir_as, clear_path, create_dir_if_non_existent, dir_is_empty, try_infer_extension};
|
||||
pub use fs::{
|
||||
cd_into_same_dir_as, clear_path, create_dir_if_non_existent, dir_is_empty, is_symlink, try_infer_extension,
|
||||
};
|
||||
pub use question::{
|
||||
create_or_ask_overwrite, user_wants_to_continue_decompressing, user_wants_to_overwrite, QuestionPolicy,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user