mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
Merge pull request #741 from jbcrail/rm-path-shim
Remove trait shim needed before Path stabilized
This commit is contained in:
commit
f0c8b5b89e
12 changed files with 28 additions and 67 deletions
|
@ -28,7 +28,6 @@ use std::ffi::CString;
|
||||||
use std::io::{Error, Write};
|
use std::io::{Error, Write};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uucore::fs::UUPathExt;
|
|
||||||
use walker::Walker;
|
use walker::Walker;
|
||||||
|
|
||||||
const NAME: &'static str = "chmod";
|
const NAME: &'static str = "chmod";
|
||||||
|
@ -149,8 +148,8 @@ fn chmod(files: Vec<String>, changes: bool, quiet: bool, verbose: bool, preserve
|
||||||
for filename in files.iter() {
|
for filename in files.iter() {
|
||||||
let filename = &filename[..];
|
let filename = &filename[..];
|
||||||
let file = Path::new(filename);
|
let file = Path::new(filename);
|
||||||
if file.uu_exists() {
|
if file.exists() {
|
||||||
if file.uu_is_dir() {
|
if file.is_dir() {
|
||||||
if !preserve_root || filename != "/" {
|
if !preserve_root || filename != "/" {
|
||||||
if recursive {
|
if recursive {
|
||||||
let walk_dir = match Walker::new(&file) {
|
let walk_dir = match Walker::new(&file) {
|
||||||
|
@ -273,7 +272,7 @@ fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool
|
||||||
'w' => rwx |= 0o002,
|
'w' => rwx |= 0o002,
|
||||||
'x' => rwx |= 0o001,
|
'x' => rwx |= 0o001,
|
||||||
'X' => {
|
'X' => {
|
||||||
if file.uu_is_dir() || (fperm & 0o0111) != 0 {
|
if file.is_dir() || (fperm & 0o0111) != 0 {
|
||||||
rwx |= 0o001;
|
rwx |= 0o001;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ use std::iter::FromIterator;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use uucore::c_types::{get_pw_from_args, get_group};
|
use uucore::c_types::{get_pw_from_args, get_group};
|
||||||
use uucore::fs::UUPathExt;
|
|
||||||
|
|
||||||
extern {
|
extern {
|
||||||
fn chroot(path: *const libc::c_char) -> libc::c_int;
|
fn chroot(path: *const libc::c_char) -> libc::c_int;
|
||||||
|
@ -77,7 +76,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
let user_shell = std::env::var("SHELL");
|
let user_shell = std::env::var("SHELL");
|
||||||
|
|
||||||
let newroot = Path::new(&matches.free[0][..]);
|
let newroot = Path::new(&matches.free[0][..]);
|
||||||
if !newroot.uu_is_dir() {
|
if !newroot.is_dir() {
|
||||||
crash!(1, "cannot change root directory to `{}`: no such directory", newroot.display());
|
crash!(1, "cannot change root directory to `{}`: no such directory", newroot.display());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ use getopts::Options;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{ErrorKind, Result, Write};
|
use std::io::{ErrorKind, Result, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uucore::fs::{canonicalize, CanonicalizeMode, UUPathExt};
|
use uucore::fs::{canonicalize, CanonicalizeMode};
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
pub enum Mode {
|
pub enum Mode {
|
||||||
|
@ -118,7 +118,7 @@ fn copy(matches: getopts::Matches) {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !dest.uu_is_dir() {
|
if !dest.is_dir() {
|
||||||
show_error!("TARGET must be a directory");
|
show_error!("TARGET must be a directory");
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ fn copy(matches: getopts::Matches) {
|
||||||
for src in sources.iter() {
|
for src in sources.iter() {
|
||||||
let source = Path::new(&src);
|
let source = Path::new(&src);
|
||||||
|
|
||||||
if !source.uu_is_file() {
|
if !source.is_file() {
|
||||||
show_error!("\"{}\" is not a file", source.display());
|
show_error!("\"{}\" is not a file", source.display());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ extern crate uucore;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{stdout, stdin, BufRead, BufReader, Read, Stdout, Write};
|
use std::io::{stdout, stdin, BufRead, BufReader, Read, Stdout, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uucore::fs::UUPathExt;
|
|
||||||
|
|
||||||
use ranges::Range;
|
use ranges::Range;
|
||||||
use searcher::Searcher;
|
use searcher::Searcher;
|
||||||
|
@ -379,7 +378,7 @@ fn cut_files(mut filenames: Vec<String>, mode: Mode) -> i32 {
|
||||||
} else {
|
} else {
|
||||||
let path = Path::new(&filename[..]);
|
let path = Path::new(&filename[..]);
|
||||||
|
|
||||||
if !path.uu_exists() {
|
if !path.exists() {
|
||||||
show_error!("{}: No such file or directory", filename);
|
show_error!("{}: No such file or directory", filename);
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
11
src/ln/ln.rs
11
src/ln/ln.rs
|
@ -19,7 +19,6 @@ use std::io::{BufRead, BufReader, Result, stdin, Write};
|
||||||
#[cfg(unix)] use std::os::unix::fs::symlink as symlink_file;
|
#[cfg(unix)] use std::os::unix::fs::symlink as symlink_file;
|
||||||
#[cfg(windows)] use std::os::windows::fs::symlink_file;
|
#[cfg(windows)] use std::os::windows::fs::symlink_file;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use uucore::fs::UUPathExt;
|
|
||||||
|
|
||||||
static NAME: &'static str = "ln";
|
static NAME: &'static str = "ln";
|
||||||
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||||
|
@ -200,7 +199,7 @@ fn exec(files: &[PathBuf], settings: &Settings) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Settings) -> i32 {
|
fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Settings) -> i32 {
|
||||||
if !target_dir.uu_is_dir() {
|
if !target_dir.is_dir() {
|
||||||
show_error!("target '{}' is not a directory", target_dir.display());
|
show_error!("target '{}' is not a directory", target_dir.display());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -232,13 +231,13 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Setting
|
||||||
fn link(src: &PathBuf, dst: &PathBuf, settings: &Settings) -> Result<()> {
|
fn link(src: &PathBuf, dst: &PathBuf, settings: &Settings) -> Result<()> {
|
||||||
let mut backup_path = None;
|
let mut backup_path = None;
|
||||||
|
|
||||||
if dst.uu_is_dir() {
|
if dst.is_dir() {
|
||||||
if settings.no_target_dir {
|
if settings.no_target_dir {
|
||||||
try!(fs::remove_dir(dst));
|
try!(fs::remove_dir(dst));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_symlink(dst) || dst.uu_exists() {
|
if is_symlink(dst) || dst.exists() {
|
||||||
match settings.overwrite {
|
match settings.overwrite {
|
||||||
OverwriteMode::NoClobber => {},
|
OverwriteMode::NoClobber => {},
|
||||||
OverwriteMode::Interactive => {
|
OverwriteMode::Interactive => {
|
||||||
|
@ -301,7 +300,7 @@ fn numbered_backup_path(path: &PathBuf) -> PathBuf {
|
||||||
let mut i: u64 = 1;
|
let mut i: u64 = 1;
|
||||||
loop {
|
loop {
|
||||||
let new_path = simple_backup_path(path, &format!(".~{}~", i));
|
let new_path = simple_backup_path(path, &format!(".~{}~", i));
|
||||||
if !new_path.uu_exists() {
|
if !new_path.exists() {
|
||||||
return new_path;
|
return new_path;
|
||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
|
@ -310,7 +309,7 @@ fn numbered_backup_path(path: &PathBuf) -> PathBuf {
|
||||||
|
|
||||||
fn existing_backup_path(path: &PathBuf, suffix: &String) -> PathBuf {
|
fn existing_backup_path(path: &PathBuf, suffix: &String) -> PathBuf {
|
||||||
let test_path = simple_backup_path(path, &".~1~".to_string());
|
let test_path = simple_backup_path(path, &".~1~".to_string());
|
||||||
if test_path.uu_exists() {
|
if test_path.exists() {
|
||||||
return numbered_backup_path(path);
|
return numbered_backup_path(path);
|
||||||
}
|
}
|
||||||
simple_backup_path(path, suffix)
|
simple_backup_path(path, suffix)
|
||||||
|
|
|
@ -18,7 +18,6 @@ extern crate uucore;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use uucore::fs::UUPathExt;
|
|
||||||
|
|
||||||
static NAME: &'static str = "mkdir";
|
static NAME: &'static str = "mkdir";
|
||||||
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||||
|
@ -100,7 +99,7 @@ fn exec(dirs: Vec<String>, recursive: bool, mode: u16, verbose: bool) -> i32 {
|
||||||
} else {
|
} else {
|
||||||
match path.parent() {
|
match path.parent() {
|
||||||
Some(parent) => {
|
Some(parent) => {
|
||||||
if parent != empty && !parent.uu_exists() {
|
if parent != empty && !parent.exists() {
|
||||||
show_info!("cannot create directory '{}': No such file or directory", path.display());
|
show_info!("cannot create directory '{}': No such file or directory", path.display());
|
||||||
status = 1;
|
status = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -120,7 +119,7 @@ fn exec(dirs: Vec<String>, recursive: bool, mode: u16, verbose: bool) -> i32 {
|
||||||
* Wrapper to catch errors, return 1 if failed
|
* Wrapper to catch errors, return 1 if failed
|
||||||
*/
|
*/
|
||||||
fn mkdir(path: &Path, mode: u16, verbose: bool) -> i32 {
|
fn mkdir(path: &Path, mode: u16, verbose: bool) -> i32 {
|
||||||
if path.uu_exists() {
|
if path.exists() {
|
||||||
show_info!("cannot create directory '{}': File exists", path.display());
|
show_info!("cannot create directory '{}': File exists", path.display());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
15
src/mv/mv.rs
15
src/mv/mv.rs
|
@ -20,7 +20,6 @@ use std::fs;
|
||||||
use std::io::{BufRead, BufReader, Result, stdin, Write};
|
use std::io::{BufRead, BufReader, Result, stdin, Write};
|
||||||
use std::os::unix::fs::MetadataExt;
|
use std::os::unix::fs::MetadataExt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use uucore::fs::UUPathExt;
|
|
||||||
|
|
||||||
static NAME: &'static str = "mv";
|
static NAME: &'static str = "mv";
|
||||||
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||||
|
@ -195,14 +194,14 @@ fn exec(files: &[PathBuf], b: Behaviour) -> i32 {
|
||||||
2 => {
|
2 => {
|
||||||
let ref source = files[0];
|
let ref source = files[0];
|
||||||
let ref target = files[1];
|
let ref target = files[1];
|
||||||
if !source.uu_exists() {
|
if !source.exists() {
|
||||||
show_error!("cannot stat ‘{}’: No such file or directory", source.display());
|
show_error!("cannot stat ‘{}’: No such file or directory", source.display());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.uu_is_dir() {
|
if target.is_dir() {
|
||||||
if b.no_target_dir {
|
if b.no_target_dir {
|
||||||
if !source.uu_is_dir() {
|
if !source.is_dir() {
|
||||||
show_error!("cannot overwrite directory ‘{}’ with non-directory",
|
show_error!("cannot overwrite directory ‘{}’ with non-directory",
|
||||||
target.display());
|
target.display());
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -242,7 +241,7 @@ fn exec(files: &[PathBuf], b: Behaviour) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behaviour) -> i32 {
|
fn move_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behaviour) -> i32 {
|
||||||
if !target_dir.uu_is_dir() {
|
if !target_dir.is_dir() {
|
||||||
show_error!("target ‘{}’ is not a directory", target_dir.display());
|
show_error!("target ‘{}’ is not a directory", target_dir.display());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +274,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behaviour) -
|
||||||
fn rename(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> Result<()> {
|
fn rename(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> Result<()> {
|
||||||
let mut backup_path = None;
|
let mut backup_path = None;
|
||||||
|
|
||||||
if to.uu_exists() {
|
if to.exists() {
|
||||||
match b.overwrite {
|
match b.overwrite {
|
||||||
OverwriteMode::NoClobber => return Ok(()),
|
OverwriteMode::NoClobber => return Ok(()),
|
||||||
OverwriteMode::Interactive => {
|
OverwriteMode::Interactive => {
|
||||||
|
@ -337,7 +336,7 @@ fn numbered_backup_path(path: &PathBuf) -> PathBuf {
|
||||||
let mut i: u64 = 1;
|
let mut i: u64 = 1;
|
||||||
loop {
|
loop {
|
||||||
let new_path = simple_backup_path(path, &format!(".~{}~", i));
|
let new_path = simple_backup_path(path, &format!(".~{}~", i));
|
||||||
if !new_path.uu_exists() {
|
if !new_path.exists() {
|
||||||
return new_path;
|
return new_path;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
|
@ -346,7 +345,7 @@ fn numbered_backup_path(path: &PathBuf) -> PathBuf {
|
||||||
|
|
||||||
fn existing_backup_path(path: &PathBuf, suffix: &String) -> PathBuf {
|
fn existing_backup_path(path: &PathBuf, suffix: &String) -> PathBuf {
|
||||||
let test_path = simple_backup_path(path, &".~1~".to_string());
|
let test_path = simple_backup_path(path, &".~1~".to_string());
|
||||||
if test_path.uu_exists() {
|
if test_path.exists() {
|
||||||
return numbered_backup_path(path);
|
return numbered_backup_path(path);
|
||||||
}
|
}
|
||||||
simple_backup_path(path, suffix)
|
simple_backup_path(path, suffix)
|
||||||
|
|
|
@ -20,7 +20,6 @@ use std::fs;
|
||||||
use std::io::{stdin, stderr, BufRead, Write};
|
use std::io::{stdin, stderr, BufRead, Write};
|
||||||
use std::ops::BitOr;
|
use std::ops::BitOr;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use uucore::fs::UUPathExt;
|
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Clone, Copy)]
|
#[derive(Eq, PartialEq, Clone, Copy)]
|
||||||
enum InteractiveMode {
|
enum InteractiveMode {
|
||||||
|
@ -130,8 +129,8 @@ fn remove(files: Vec<String>, force: bool, interactive: InteractiveMode, one_fs:
|
||||||
for filename in files.iter() {
|
for filename in files.iter() {
|
||||||
let filename = &filename[..];
|
let filename = &filename[..];
|
||||||
let file = Path::new(filename);
|
let file = Path::new(filename);
|
||||||
if file.uu_exists() {
|
if file.exists() {
|
||||||
if file.uu_is_dir() {
|
if file.is_dir() {
|
||||||
if recursive && (filename != "/" || !preserve_root) {
|
if recursive && (filename != "/" || !preserve_root) {
|
||||||
if interactive != InteractiveMode::InteractiveAlways {
|
if interactive != InteractiveMode::InteractiveAlways {
|
||||||
match fs::remove_dir_all(file) {
|
match fs::remove_dir_all(file) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ use std::io::{self, Write};
|
||||||
use std::os::unix::process::ExitStatusExt;
|
use std::os::unix::process::ExitStatusExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use uucore::fs::{canonicalize, CanonicalizeMode, UUPathExt};
|
use uucore::fs::{canonicalize, CanonicalizeMode};
|
||||||
|
|
||||||
static NAME: &'static str = "stdbuf";
|
static NAME: &'static str = "stdbuf";
|
||||||
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||||
|
@ -201,7 +201,7 @@ fn get_preload_env() -> (String, String) {
|
||||||
// First search for library in directory of executable.
|
// First search for library in directory of executable.
|
||||||
let mut path = exe_path().unwrap_or_else(|_| crash!(1, "Impossible to fetch the path of this executable."));
|
let mut path = exe_path().unwrap_or_else(|_| crash!(1, "Impossible to fetch the path of this executable."));
|
||||||
path.push(libstdbuf.clone());
|
path.push(libstdbuf.clone());
|
||||||
if path.uu_exists() {
|
if path.exists() {
|
||||||
match path.as_os_str().to_str() {
|
match path.as_os_str().to_str() {
|
||||||
Some(s) => { return (preload.to_string(), s.to_string()); },
|
Some(s) => { return (preload.to_string(), s.to_string()); },
|
||||||
None => crash!(1, "Error while converting path.")
|
None => crash!(1, "Error while converting path.")
|
||||||
|
|
|
@ -21,7 +21,6 @@ use filetime::*;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{Error, Write};
|
use std::io::{Error, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uucore::fs::UUPathExt;
|
|
||||||
|
|
||||||
static NAME: &'static str = "touch";
|
static NAME: &'static str = "touch";
|
||||||
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||||
|
@ -108,7 +107,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
for filename in matches.free.iter() {
|
for filename in matches.free.iter() {
|
||||||
let path = &filename[..];
|
let path = &filename[..];
|
||||||
|
|
||||||
if !Path::new(path).uu_exists() {
|
if !Path::new(path).exists() {
|
||||||
// no-dereference included here for compatibility
|
// no-dereference included here for compatibility
|
||||||
if matches.opts_present(&["no-create".to_string(), "no-dereference".to_string()]) {
|
if matches.opts_present(&["no-create".to_string(), "no-dereference".to_string()]) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -7,11 +7,6 @@
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Based on the pattern using by Cargo, I created a shim over the
|
|
||||||
// standard PathExt trait, so that the unstable path methods could
|
|
||||||
// be backported to stable (<= 1.1). This will likely be dropped
|
|
||||||
// when the path trait stabilizes.
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use super::libc;
|
use super::libc;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -19,31 +14,6 @@ use std::fs;
|
||||||
use std::io::{Error, ErrorKind, Result};
|
use std::io::{Error, ErrorKind, Result};
|
||||||
use std::path::{Component, Path, PathBuf};
|
use std::path::{Component, Path, PathBuf};
|
||||||
|
|
||||||
pub trait UUPathExt {
|
|
||||||
fn uu_exists(&self) -> bool;
|
|
||||||
fn uu_is_file(&self) -> bool;
|
|
||||||
fn uu_is_dir(&self) -> bool;
|
|
||||||
fn uu_metadata(&self) -> Result<fs::Metadata>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl UUPathExt for Path {
|
|
||||||
fn uu_exists(&self) -> bool {
|
|
||||||
fs::metadata(self).is_ok()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn uu_is_file(&self) -> bool {
|
|
||||||
fs::metadata(self).map(|m| m.is_file()).unwrap_or(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn uu_is_dir(&self) -> bool {
|
|
||||||
fs::metadata(self).map(|m| m.is_dir()).unwrap_or(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn uu_metadata(&self) -> Result<fs::Metadata> {
|
|
||||||
fs::metadata(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum CanonicalizeMode {
|
pub enum CanonicalizeMode {
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -22,7 +22,6 @@ use std::io::{stdin, BufRead, BufReader, Read, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::result::Result as StdResult;
|
use std::result::Result as StdResult;
|
||||||
use std::str::from_utf8;
|
use std::str::from_utf8;
|
||||||
use uucore::fs::UUPathExt;
|
|
||||||
|
|
||||||
struct Settings {
|
struct Settings {
|
||||||
show_bytes: bool,
|
show_bytes: bool,
|
||||||
|
@ -263,7 +262,7 @@ fn open(path: &str) -> StdResult<BufReader<Box<Read+'static>>, i32> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let fpath = Path::new(path);
|
let fpath = Path::new(path);
|
||||||
if fpath.uu_is_dir() {
|
if fpath.is_dir() {
|
||||||
show_info!("{}: is a directory", path);
|
show_info!("{}: is a directory", path);
|
||||||
}
|
}
|
||||||
match File::open(&fpath) {
|
match File::open(&fpath) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue