mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
Fix build for latest Rust
This commit is contained in:
parent
23a4bc2d08
commit
68fd0971d0
5 changed files with 10 additions and 11 deletions
|
@ -122,13 +122,13 @@ fn copy(matches: getopts::Matches) {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if fs::stat(&dest).unwrap().kind != io::TypeDirectory {
|
if fs::stat(&dest).unwrap().kind != io::FileType::Directory {
|
||||||
error!("error: TARGET must be a directory");
|
error!("error: TARGET must be a directory");
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
|
|
||||||
for source in sources.iter() {
|
for source in sources.iter() {
|
||||||
if fs::stat(source).unwrap().kind != io::TypeFile {
|
if fs::stat(source).unwrap().kind != io::FileType::RegularFile {
|
||||||
error!("error: \"{}\" is not a file", source.display().to_string());
|
error!("error: \"{}\" is not a file", source.display().to_string());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -165,12 +165,12 @@ pub fn paths_refer_to_same_file(p1: &Path, p2: &Path) -> io::IoResult<bool> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// We have to take symlinks and relative paths into account.
|
// We have to take symlinks and relative paths into account.
|
||||||
if p1_lstat.kind == io::TypeSymlink {
|
if p1_lstat.kind == io::FileType::Symlink {
|
||||||
raw_p1 = fs::readlink(&raw_p1).unwrap();
|
raw_p1 = fs::readlink(&raw_p1).unwrap();
|
||||||
}
|
}
|
||||||
raw_p1 = os::make_absolute(&raw_p1).unwrap();
|
raw_p1 = os::make_absolute(&raw_p1).unwrap();
|
||||||
|
|
||||||
if p2_lstat.kind == io::TypeSymlink {
|
if p2_lstat.kind == io::FileType::Symlink {
|
||||||
raw_p2 = fs::readlink(&raw_p2).unwrap();
|
raw_p2 = fs::readlink(&raw_p2).unwrap();
|
||||||
}
|
}
|
||||||
raw_p2 = os::make_absolute(&raw_p2).unwrap();
|
raw_p2 = os::make_absolute(&raw_p2).unwrap();
|
||||||
|
|
|
@ -16,7 +16,7 @@ extern crate getopts;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate time;
|
extern crate time;
|
||||||
|
|
||||||
use std::io::{stderr, fs, FileStat, TypeDirectory};
|
use std::io::{stderr, fs, FileStat, FileType};
|
||||||
use std::num::Float;
|
use std::num::Float;
|
||||||
use std::option::Option;
|
use std::option::Option;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -48,7 +48,7 @@ fn du(path: &Path, mut my_stat: Stat,
|
||||||
let mut stats = vec!();
|
let mut stats = vec!();
|
||||||
let mut futures = vec!();
|
let mut futures = vec!();
|
||||||
|
|
||||||
if my_stat.fstat.kind == TypeDirectory {
|
if my_stat.fstat.kind == FileType::Directory {
|
||||||
let read = match fs::readdir(path) {
|
let read = match fs::readdir(path) {
|
||||||
Ok(read) => read,
|
Ok(read) => read,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -60,7 +60,7 @@ fn du(path: &Path, mut my_stat: Stat,
|
||||||
|
|
||||||
for f in read.into_iter() {
|
for f in read.into_iter() {
|
||||||
let this_stat = Stat{path: f.clone(), fstat: safe_unwrap!(fs::lstat(&f))};
|
let this_stat = Stat{path: f.clone(), fstat: safe_unwrap!(fs::lstat(&f))};
|
||||||
if this_stat.fstat.kind == TypeDirectory {
|
if this_stat.fstat.kind == FileType::Directory {
|
||||||
let oa_clone = options.clone();
|
let oa_clone = options.clone();
|
||||||
futures.push(Future::spawn(proc() { du(&f, this_stat, oa_clone, depth + 1) }))
|
futures.push(Future::spawn(proc() { du(&f, this_stat, oa_clone, depth + 1) }))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -89,7 +89,7 @@ fn resolve_path(path: &str, strip: bool, zero: bool, quiet: bool) -> bool {
|
||||||
}
|
}
|
||||||
match std::io::fs::lstat(&result) {
|
match std::io::fs::lstat(&result) {
|
||||||
Err(_) => break,
|
Err(_) => break,
|
||||||
Ok(ref s) if s.kind != std::io::TypeSymlink => break,
|
Ok(ref s) if s.kind != std::io::FileType::Symlink => break,
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
links_left -= 1;
|
links_left -= 1;
|
||||||
match std::io::fs::readlink(&result) {
|
match std::io::fs::readlink(&result) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![crate_name = "tee"]
|
#![crate_name = "tee"]
|
||||||
#![license="MIT"]
|
|
||||||
#![feature(phase)]
|
#![feature(phase)]
|
||||||
#![feature(macro_rules)]
|
#![feature(macro_rules)]
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,8 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
let result = path.lstat().and_then(|info| {
|
let result = path.lstat().and_then(|info| {
|
||||||
match info.kind {
|
match info.kind {
|
||||||
io::TypeFile => Ok(()),
|
io::FileType::RegularFile => Ok(()),
|
||||||
io::TypeSymlink => Ok(()),
|
io::FileType::Symlink => Ok(()),
|
||||||
_ => Err(io::IoError {
|
_ => Err(io::IoError {
|
||||||
kind: io::OtherIoError,
|
kind: io::OtherIoError,
|
||||||
desc: "is not a file or symlink",
|
desc: "is not a file or symlink",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue