libstd: Change Path::new to Path::init.

This commit is contained in:
Patrick Walton 2013-11-22 15:45:12 -08:00
parent 6c672ee094
commit c54427ddfb
40 changed files with 546 additions and 541 deletions

View file

@ -72,7 +72,7 @@ fn shift_push() {
fn read_line() {
use std::io::buffered::BufferedReader;
let mut path = Path::new(env!("CFG_SRC_DIR"));
let mut path = Path::init(env!("CFG_SRC_DIR"));
path.push("src/test/bench/shootout-k-nucleotide.data");
for _ in range(0, 3) {

View file

@ -123,7 +123,7 @@ fn main() {
};
let writer = if os::getenv("RUST_BENCH").is_some() {
let file = File::create(&Path::new("./shootout-fasta.data"));
let file = File::create(&Path::init("./shootout-fasta.data"));
@mut file as @mut io::Writer
} else {
@mut io::stdout() as @mut io::Writer

View file

@ -22,14 +22,14 @@ use std::io;
pub fn main() {
fn mk_file(path: &str, directory: bool) {
if directory {
io::fs::mkdir(&Path::new(path), io::UserRWX);
io::fs::mkdir(&Path::init(path), io::UserRWX);
} else {
io::File::create(&Path::new(path));
io::File::create(&Path::init(path));
}
}
fn abs_path(path: &str) -> Path {
os::getcwd().join(&Path::new(path))
os::getcwd().join(&Path::init(path))
}
fn glob_vec(pattern: &str) -> ~[Path] {

View file

@ -23,7 +23,7 @@ fn tester()
{
let loader: rsrc_loader = proc(_path) {result::Ok(~"more blah")};
let path = path::Path::new("blah");
let path = path::Path::init("blah");
assert!(loader(&path).is_ok());
}

View file

@ -16,7 +16,7 @@ use extra::tempfile;
use std::io::File;
pub fn main() {
let dir = tempfile::TempDir::new_in(&Path::new("."), "").unwrap();
let dir = tempfile::TempDir::new_in(&Path::init("."), "").unwrap();
let path = dir.path().join("file");
{

View file

@ -30,7 +30,7 @@ use std::io::fs;
fn test_tempdir() {
let path = {
let p = TempDir::new_in(&Path::new("."), "foobar").unwrap();
let p = TempDir::new_in(&Path::init("."), "foobar").unwrap();
let p = p.path();
assert!(p.as_vec().ends_with(bytes!("foobar")));
p.clone()
@ -83,7 +83,7 @@ fn test_rm_tempdir() {
// Ideally these would be in std::os but then core would need
// to depend on std
fn recursive_mkdir_rel() {
let path = Path::new("frob");
let path = Path::init("frob");
let cwd = os::getcwd();
debug!("recursive_mkdir_rel: Making: {} in cwd {} [{:?}]", path.display(),
cwd.display(), path.exists());
@ -94,21 +94,21 @@ fn recursive_mkdir_rel() {
}
fn recursive_mkdir_dot() {
let dot = Path::new(".");
let dot = Path::init(".");
fs::mkdir_recursive(&dot, io::UserRWX);
let dotdot = Path::new("..");
let dotdot = Path::init("..");
fs::mkdir_recursive(&dotdot, io::UserRWX);
}
fn recursive_mkdir_rel_2() {
let path = Path::new("./frob/baz");
let path = Path::init("./frob/baz");
let cwd = os::getcwd();
debug!("recursive_mkdir_rel_2: Making: {} in cwd {} [{:?}]", path.display(),
cwd.display(), path.exists());
fs::mkdir_recursive(&path, io::UserRWX);
assert!(path.is_dir());
assert!(path.dir_path().is_dir());
let path2 = Path::new("quux/blat");
let path2 = Path::init("quux/blat");
debug!("recursive_mkdir_rel_2: Making: {} in cwd {}", path2.display(),
cwd.display());
fs::mkdir_recursive(&path2, io::UserRWX);