diff options
| author | Kevin Ballard <kevin@sb.org> | 2013-10-05 19:49:32 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2013-10-15 22:18:30 -0700 |
| commit | d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd (patch) | |
| tree | e197783b86700e71d94c9bc6d0254eb25b16cc0c /src/librustpkg | |
| parent | ed539e14712539473c3e89604cb69e2307110772 (diff) | |
| download | rust-d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd.tar.gz rust-d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd.zip | |
path2: Adjust the API to remove all the _str mutation methods
Add a new trait BytesContainer that is implemented for both byte vectors and strings. Convert Path::from_vec and ::from_str to one function, Path::new(). Remove all the _str-suffixed mutation methods (push, join, with_*, set_*) and modify the non-suffixed versions to use BytesContainer.
Diffstat (limited to 'src/librustpkg')
| -rw-r--r-- | src/librustpkg/api.rs | 10 | ||||
| -rw-r--r-- | src/librustpkg/context.rs | 2 | ||||
| -rw-r--r-- | src/librustpkg/installed_packages.rs | 8 | ||||
| -rw-r--r-- | src/librustpkg/package_id.rs | 6 | ||||
| -rw-r--r-- | src/librustpkg/package_source.rs | 17 | ||||
| -rw-r--r-- | src/librustpkg/path_util.rs | 20 | ||||
| -rw-r--r-- | src/librustpkg/rustpkg.rs | 18 | ||||
| -rw-r--r-- | src/librustpkg/source_control.rs | 8 | ||||
| -rw-r--r-- | src/librustpkg/target.rs | 2 | ||||
| -rw-r--r-- | src/librustpkg/tests.rs | 374 | ||||
| -rw-r--r-- | src/librustpkg/util.rs | 8 | ||||
| -rw-r--r-- | src/librustpkg/version.rs | 4 | ||||
| -rw-r--r-- | src/librustpkg/workspace.rs | 4 |
13 files changed, 239 insertions, 242 deletions
diff --git a/src/librustpkg/api.rs b/src/librustpkg/api.rs index 6e0908d2a4f..02a96402229 100644 --- a/src/librustpkg/api.rs +++ b/src/librustpkg/api.rs @@ -43,17 +43,17 @@ pub fn new_default_context(c: workcache::Context, p: Path) -> BuildContext { } fn file_is_fresh(path: &str, in_hash: &str) -> bool { - let path = Path::from_str(path); + let path = Path::new(path); os::path_exists(&path) && in_hash == digest_file_with_date(&path) } fn binary_is_fresh(path: &str, in_hash: &str) -> bool { - let path = Path::from_str(path); + let path = Path::new(path); os::path_exists(&path) && in_hash == digest_only_date(&path) } pub fn new_workcache_context(p: &Path) -> workcache::Context { - let db_file = p.join_str("rustpkg_db.json"); // ??? probably wrong + let db_file = p.join("rustpkg_db.json"); // ??? probably wrong debug2!("Workcache database file: {}", db_file.display()); let db = RWArc::new(Database::new(db_file)); let lg = RWArc::new(Logger::new()); @@ -73,7 +73,7 @@ pub fn build_lib(sysroot: Path, root: Path, name: ~str, version: Version, source_workspace: root.clone(), build_in_destination: false, destination_workspace: root.clone(), - start_dir: root.join_many_str(["src", name.as_slice()]), + start_dir: root.join_many(["src", name.as_slice()]), id: PkgId{ version: version, ..PkgId::new(name)}, // n.b. This assumes the package only has one crate libs: ~[mk_crate(lib)], @@ -91,7 +91,7 @@ pub fn build_exe(sysroot: Path, root: Path, name: ~str, version: Version, source_workspace: root.clone(), build_in_destination: false, destination_workspace: root.clone(), - start_dir: root.join_many_str(["src", name.as_slice()]), + start_dir: root.join_many(["src", name.as_slice()]), id: PkgId{ version: version, ..PkgId::new(name)}, libs: ~[], // n.b. This assumes the package only has one crate diff --git a/src/librustpkg/context.rs b/src/librustpkg/context.rs index 41b04c389ae..554019133b2 100644 --- a/src/librustpkg/context.rs +++ b/src/librustpkg/context.rs @@ -156,7 +156,7 @@ impl Context { pub fn in_target(sysroot: &Path) -> bool { debug2!("Checking whether {} is in target", sysroot.display()); let mut p = sysroot.dir_path(); - p.set_filename_str("rustc"); + p.set_filename("rustc"); os::path_is_dir(&p) } diff --git a/src/librustpkg/installed_packages.rs b/src/librustpkg/installed_packages.rs index 995f484a4e6..485cbfef2f6 100644 --- a/src/librustpkg/installed_packages.rs +++ b/src/librustpkg/installed_packages.rs @@ -17,7 +17,7 @@ use std::os; pub fn list_installed_packages(f: &fn(&PkgId) -> bool) -> bool { let workspaces = rust_path(); for p in workspaces.iter() { - let binfiles = os::list_dir(&p.join_str("bin")); + let binfiles = os::list_dir(&p.join("bin")); for exec in binfiles.iter() { // FIXME (#9639): This needs to handle non-utf8 paths match exec.filestem_str() { @@ -29,17 +29,17 @@ pub fn list_installed_packages(f: &fn(&PkgId) -> bool) -> bool { } } } - let libfiles = os::list_dir(&p.join_str("lib")); + let libfiles = os::list_dir(&p.join("lib")); for lib in libfiles.iter() { debug2!("Full name: {}", lib.display()); match has_library(lib) { Some(basename) => { - let parent = p.join_str("lib"); + let parent = p.join("lib"); debug2!("parent = {}, child = {}", parent.display(), lib.display()); let rel_p = lib.path_relative_from(&parent).unwrap(); debug2!("Rel: {}", rel_p.display()); - let rel_path = rel_p.join_str(basename); + let rel_path = rel_p.join(basename); do rel_path.with_display_str |s| { debug2!("Rel name: {}", s); f(&PkgId::new(s)); diff --git a/src/librustpkg/package_id.rs b/src/librustpkg/package_id.rs index bd22f1da913..38b922ec05d 100644 --- a/src/librustpkg/package_id.rs +++ b/src/librustpkg/package_id.rs @@ -59,7 +59,7 @@ impl PkgId { } }; - let path = Path::from_str(s); + let path = Path::new(s); if !path.is_relative() { return cond.raise((path, ~"absolute pkgid")); } @@ -137,8 +137,8 @@ impl Iterator<(Path, Path)> for Prefixes { let last = self.components.pop(); self.remaining.unshift(last); // converting to str and then back is a little unfortunate - Some((Path::from_str(self.components.connect("/")), - Path::from_str(self.remaining.connect("/")))) + Some((Path::new(self.components.connect("/")), + Path::new(self.remaining.connect("/")))) } } } diff --git a/src/librustpkg/package_source.rs b/src/librustpkg/package_source.rs index a924694cca5..4e0db8cac4f 100644 --- a/src/librustpkg/package_source.rs +++ b/src/librustpkg/package_source.rs @@ -94,20 +94,20 @@ impl PkgSrc { } else { // We search for sources under both src/ and build/ , because build/ is where // automatically-checked-out sources go. - let mut result = source_workspace.join_str("src"); + let mut result = source_workspace.join("src"); result.push_path(&id.path.dir_path()); - result.push_str(format!("{}-{}", id.short_name, id.version.to_str())); + result.push(format!("{}-{}", id.short_name, id.version.to_str())); to_try.push(result); - let mut result = source_workspace.join_str("src"); + let mut result = source_workspace.join("src"); result.push_path(&id.path); to_try.push(result); - let mut result = build_dir.join_str("src"); + let mut result = build_dir.join("src"); result.push_path(&id.path.dir_path()); result.push_str(format!("{}-{}", id.short_name, id.version.to_str())); to_try.push(result.clone()); output_names.push(result); - let mut other_result = build_dir.join_str("src"); + let mut other_result = build_dir.join("src"); other_result.push_path(&id.path); to_try.push(other_result.clone()); output_names.push(other_result); @@ -129,7 +129,7 @@ impl PkgSrc { // That is, is this a package ID that points into the middle of a workspace? for (prefix, suffix) in id.prefixes_iter() { let package_id = PkgId::new(prefix.as_str().unwrap()); - let path = build_dir.join_path(&package_id.path); + let path = build_dir.join(&package_id.path); debug2!("in loop: checking if {} is a directory", path.display()); if os::path_is_dir(&path) { let ps = PkgSrc::new(source_workspace, @@ -260,6 +260,7 @@ impl PkgSrc { return None; } + // FIXME (#9639): This needs to handle non-utf8 paths let url = format!("https://{}", pkgid.path.as_str().unwrap()); debug2!("Fetching package: git clone {} {} [version={}]", url, clone_target.display(), pkgid.version.to_str()); @@ -289,7 +290,7 @@ impl PkgSrc { // If a file named "pkg.rs" in the start directory exists, // return the path for it. Otherwise, None pub fn package_script_option(&self) -> Option<Path> { - let maybe_path = self.start_dir.join_str("pkg.rs"); + let maybe_path = self.start_dir.join("pkg.rs"); debug2!("package_script_option: checking whether {} exists", maybe_path.display()); if os::path_exists(&maybe_path) { Some(maybe_path) @@ -309,7 +310,7 @@ impl PkgSrc { it.nth(prefix-1); // skip elements } assert!(it.peek().is_some()); - let mut sub = Path::from_str("."); + let mut sub = Path::new("."); for c in it { sub.push(c); } diff --git a/src/librustpkg/path_util.rs b/src/librustpkg/path_util.rs index 34b387fc9a7..0f5f1470b6f 100644 --- a/src/librustpkg/path_util.rs +++ b/src/librustpkg/path_util.rs @@ -53,7 +53,7 @@ pub fn make_dir_rwx_recursive(p: &Path) -> bool { os::mkdir_recursive(p, U_RWX) /// True if there's a directory in <workspace> with /// pkgid's short name pub fn workspace_contains_package_id(pkgid: &PkgId, workspace: &Path) -> bool { - workspace_contains_package_id_(pkgid, workspace, |p| p.join_str("src")).is_some() + workspace_contains_package_id_(pkgid, workspace, |p| p.join("src")).is_some() } pub fn workspace_contains_package_id_(pkgid: &PkgId, workspace: &Path, @@ -98,16 +98,16 @@ pub fn workspace_contains_package_id_(pkgid: &PkgId, workspace: &Path, /// Return the target-specific build subdirectory, pushed onto `base`; /// doesn't check that it exists or create it pub fn target_build_dir(workspace: &Path) -> Path { - let mut dir = workspace.join_str("build"); - dir.push_str(host_triple()); + let mut dir = workspace.join("build"); + dir.push(host_triple()); dir } /// Return the target-specific lib subdirectory, pushed onto `base`; /// doesn't check that it exists or create it fn target_lib_dir(workspace: &Path) -> Path { - let mut dir = workspace.join_str("lib"); - dir.push_str(host_triple()); + let mut dir = workspace.join("lib"); + dir.push(host_triple()); dir } @@ -115,7 +115,7 @@ fn target_lib_dir(workspace: &Path) -> Path { /// doesn't check that it exists or create it /// note: this isn't target-specific fn target_bin_dir(workspace: &Path) -> Path { - workspace.join_str("bin") + workspace.join("bin") } /// Figure out what the executable name for <pkgid> in <workspace>'s build @@ -205,7 +205,7 @@ pub fn library_in_workspace(path: &Path, short_name: &str, where: Target, // rustc doesn't use target-specific subdirectories pub fn system_library(sysroot: &Path, lib_name: &str) -> Option<Path> { - library_in(lib_name, &NoVersion, &sysroot.join_str("lib")) + library_in(lib_name, &NoVersion, &sysroot.join("lib")) } fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Option<Path> { @@ -377,9 +377,9 @@ pub fn mk_output_path(what: OutputType, where: Target, dir.display()); let mut output_path = match what { // this code is duplicated from elsewhere; fix this - Lib => dir.join_str(os::dll_filename(short_name_with_version)), + Lib => dir.join(os::dll_filename(short_name_with_version)), // executable names *aren't* versioned - _ => dir.join_str(format!("{}{}{}", pkg_id.short_name, + _ => dir.join(format!("{}{}{}", pkg_id.short_name, match what { Test => "test", Bench => "bench", @@ -416,7 +416,7 @@ pub fn uninstall_package_from(workspace: &Path, pkgid: &PkgId) { fn dir_has_file(dir: &Path, file: &str) -> bool { assert!(dir.is_absolute()); - os::path_exists(&dir.join_str(file)) + os::path_exists(&dir.join(file)) } pub fn find_dir_using_rust_path_hack(p: &PkgId) -> Option<Path> { diff --git a/src/librustpkg/rustpkg.rs b/src/librustpkg/rustpkg.rs index 47a65753cc9..5ef8948c377 100644 --- a/src/librustpkg/rustpkg.rs +++ b/src/librustpkg/rustpkg.rs @@ -146,7 +146,7 @@ impl<'self> PkgScript<'self> { let crate = util::ready_crate(sess, self.crate.take_unwrap()); debug2!("Building output filenames with script name {}", driver::source_name(&driver::file_input(self.input.clone()))); - let exe = self.build_dir.join_str("pkg" + util::exe_suffix()); + let exe = self.build_dir.join("pkg" + util::exe_suffix()); util::compile_crate_from_input(&self.input, exec, Nothing, @@ -422,7 +422,7 @@ impl CtxMethods for BuildContext { // If workspace isn't in the RUST_PATH, and it's a git repo, // then clone it into the first entry in RUST_PATH, and repeat if !in_rust_path(&workspace) && is_git_dir(&workspace.join_path(&pkgid.path)) { - let mut out_dir = default_workspace().join_str("src"); + let mut out_dir = default_workspace().join("src"); out_dir.push_path(&pkgid.path); let git_result = source_control::safe_git_clone(&workspace.join_path(&pkgid.path), &pkgid.version, @@ -488,7 +488,7 @@ impl CtxMethods for BuildContext { // Find crates inside the workspace &Everything => pkg_src.find_crates(), // Find only tests - &Tests => pkg_src.find_crates_with_filter(|s| { is_test(&Path::from_str(s)) }), + &Tests => pkg_src.find_crates_with_filter(|s| { is_test(&Path::new(s)) }), // Don't infer any crates -- just build the one that was requested &JustOne(ref p) => { // We expect that p is relative to the package source's start directory, @@ -562,7 +562,7 @@ impl CtxMethods for BuildContext { let result = self.install_no_build(pkg_src.build_workspace(), &pkg_src.destination_workspace, - &id).map(|s| Path::from_str(*s)); + &id).map(|s| Path::new(*s)); debug2!("install: id = {}, about to call discover_outputs, {:?}", id.to_str(), result.map(|p| p.to_display_str())); installed_files = installed_files + result; @@ -669,10 +669,10 @@ impl CtxMethods for BuildContext { } fn init(&self) { - os::mkdir_recursive(&Path::from_str("src"), U_RWX); - os::mkdir_recursive(&Path::from_str("lib"), U_RWX); - os::mkdir_recursive(&Path::from_str("bin"), U_RWX); - os::mkdir_recursive(&Path::from_str("build"), U_RWX); + os::mkdir_recursive(&Path::new("src"), U_RWX); + os::mkdir_recursive(&Path::new("lib"), U_RWX); + os::mkdir_recursive(&Path::new("bin"), U_RWX); + os::mkdir_recursive(&Path::new("build"), U_RWX); } fn uninstall(&self, _id: &str, _vers: Option<~str>) { @@ -852,7 +852,7 @@ pub fn main_args(args: &[~str]) -> int { let mut remaining_args: ~[~str] = remaining_args.map(|s| (*s).clone()).collect(); remaining_args.shift(); let sroot = match supplied_sysroot { - Some(getopts::Val(s)) => Path::from_str(s), + Some(getopts::Val(s)) => Path::new(s), _ => filesearch::get_or_default_sysroot() }; diff --git a/src/librustpkg/source_control.rs b/src/librustpkg/source_control.rs index b910c079205..2fc925a8a6a 100644 --- a/src/librustpkg/source_control.rs +++ b/src/librustpkg/source_control.rs @@ -43,7 +43,7 @@ pub fn safe_git_clone(source: &Path, v: &Version, target: &Path) -> CloneResult else { match v { &ExactRevision(ref s) => { - let git_dir = target.join_str(".git"); + let git_dir = target.join(".git"); debug2!("`Running: git --work-tree={} --git-dir={} checkout {}", *s, target.display(), git_dir.display()); // FIXME (#9639: This needs to handle non-utf8 paths @@ -64,7 +64,7 @@ pub fn safe_git_clone(source: &Path, v: &Version, target: &Path) -> CloneResult // Check that no version was specified. There's no reason to not handle the // case where a version was requested, but I haven't implemented it. assert!(*v == NoVersion); - let git_dir = target.join_str(".git"); + let git_dir = target.join(".git"); debug2!("Running: git --work-tree={} --git-dir={} pull --no-edit {}", target.display(), git_dir.display(), source.display()); // FIXME (#9639: This needs to handle non-utf8 paths @@ -80,7 +80,7 @@ pub fn safe_git_clone(source: &Path, v: &Version, target: &Path) -> CloneResult let scratch_dir = TempDir::new("rustpkg"); let clone_target = match scratch_dir { - Some(d) => d.unwrap().join_str("rustpkg_temp"), + Some(d) => d.unwrap().join("rustpkg_temp"), None => cond.raise(~"Failed to create temporary directory for fetching git sources") }; @@ -136,5 +136,5 @@ fn process_output_in_cwd(prog: &str, args: &[~str], cwd: &Path) -> ProcessOutput } pub fn is_git_dir(p: &Path) -> bool { - os::path_is_dir(&p.join_str(".git")) + os::path_is_dir(&p.join(".git")) } diff --git a/src/librustpkg/target.rs b/src/librustpkg/target.rs index 9f371a86535..b21641a5e53 100644 --- a/src/librustpkg/target.rs +++ b/src/librustpkg/target.rs @@ -56,7 +56,7 @@ fn file_is(p: &Path, stem: &str) -> bool { } pub fn lib_name_of(p: &Path) -> Path { - p.join_str("lib.rs") + p.join("lib.rs") } pub static lib_crate_filename: &'static str = "lib.rs"; diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs index de7ad9dc06b..cb40c3c0090 100644 --- a/src/librustpkg/tests.rs +++ b/src/librustpkg/tests.rs @@ -41,7 +41,7 @@ use util::datestamp; fn fake_ctxt(sysroot: Path, workspace: &Path) -> BuildContext { let context = workcache::Context::new( - RWArc::new(Database::new(workspace.join_str("rustpkg_db.json"))), + RWArc::new(Database::new(workspace.join("rustpkg_db.json"))), RWArc::new(Logger::new()), Arc::new(TreeMap::new())); BuildContext { @@ -59,7 +59,7 @@ fn fake_ctxt(sysroot: Path, workspace: &Path) -> BuildContext { fn fake_pkg() -> PkgId { let sn = ~"bogus"; PkgId { - path: Path::from_str(sn), + path: Path::new(sn.as_slice()), short_name: sn, version: NoVersion } @@ -67,7 +67,7 @@ fn fake_pkg() -> PkgId { fn git_repo_pkg() -> PkgId { PkgId { - path: Path::from_str("mockgithub.com/catamorphism/test-pkg"), + path: Path::new("mockgithub.com/catamorphism/test-pkg"), short_name: ~"test-pkg", version: NoVersion } @@ -75,7 +75,7 @@ fn git_repo_pkg() -> PkgId { fn git_repo_pkg_with_tag(a_tag: ~str) -> PkgId { PkgId { - path: Path::from_str("mockgithub.com/catamorphism/test-pkg"), + path: Path::new("mockgithub.com/catamorphism/test-pkg"), short_name: ~"test-pkg", version: Tagged(a_tag) } @@ -102,18 +102,18 @@ fn mk_empty_workspace(short_name: &Path, version: &Version, tag: &str) -> TempDi fn mk_workspace(workspace: &Path, short_name: &Path, version: &Version) -> Path { // include version number in directory name // FIXME (#9639): This needs to handle non-utf8 paths - let package_dir = workspace.join_many_str([~"src", format!("{}-{}", - short_name.as_str().unwrap(), version.to_str())]); + let package_dir = workspace.join_many([~"src", format!("{}-{}", + short_name.as_str().unwrap(), version.to_str())]); assert!(os::mkdir_recursive(&package_dir, U_RWX)); package_dir } fn mk_temp_workspace(short_name: &Path, version: &Version) -> (TempDir, Path) { let workspace_dir = mk_empty_workspace(short_name, version, "temp_workspace"); - let package_dir = workspace_dir.path().join_many_str([~"src", - format!("{}-{}", - short_name.to_str(), - version.to_str())]); + let package_dir = workspace_dir.path().join_many([~"src", + format!("{}-{}", + short_name.to_str(), + version.to_str())]); debug2!("Created {} and does it exist? {:?}", package_dir.display(), os::path_is_dir(&package_dir)); @@ -124,13 +124,13 @@ fn mk_temp_workspace(short_name: &Path, version: &Version) -> (TempDir, Path) { os::path_is_dir(&package_dir)); // Create main, lib, test, and bench files - writeFile(&package_dir.join_str("main.rs"), + writeFile(&package_dir.join("main.rs"), "fn main() { let _x = (); }"); - writeFile(&package_dir.join_str("lib.rs"), + writeFile(&package_dir.join("lib.rs"), "pub fn f() { let _x = (); }"); - writeFile(&package_dir.join_str("test.rs"), + writeFile(&package_dir.join("test.rs"), "#[test] pub fn f() { (); }"); - writeFile(&package_dir.join_str("bench.rs"), + writeFile(&package_dir.join("bench.rs"), "#[bench] pub fn f() { (); }"); (workspace_dir, package_dir) } @@ -163,7 +163,7 @@ fn init_git_repo(p: &Path) -> TempDir { run_git([~"init"], None, &work_dir_for_opts, format!("Couldn't initialize git repository in {}", work_dir.display())); // Add stuff to the dir so that git tag succeeds - writeFile(&work_dir.join_str("README"), ""); + writeFile(&work_dir.join("README"), ""); run_git([~"add", ~"README"], None, &work_dir_for_opts, format!("Couldn't add in {}", work_dir.display())); git_commit(&work_dir_for_opts, ~"whatever"); @@ -232,13 +232,13 @@ fn test_sysroot() -> Path { // Returns the path to rustpkg fn rustpkg_exec() -> Path { // Ugh - let first_try = test_sysroot().join_many_str( + let first_try = test_sysroot().join_many( [~"lib", ~"rustc", host_triple(), ~"bin", ~"rustpkg"]); if is_executable(&first_try) { first_try } else { - let second_try = test_sysroot().join_many_str(["bin", "rustpkg"]); + let second_try = test_sysroot().join_many(["bin", "rustpkg"]); if is_executable(&second_try) { second_try } @@ -328,7 +328,7 @@ fn create_local_package(pkgid: &PkgId) -> TempDir { fn create_local_package_in(pkgid: &PkgId, pkgdir: &Path) -> Path { - let package_dir = pkgdir.join_many_str([~"src", pkgid.to_str()]); + let package_dir = pkgdir.join_many([~"src", pkgid.to_str()]); // Create main, lib, test, and bench files assert!(os::mkdir_recursive(&package_dir, U_RWX)); @@ -336,13 +336,13 @@ fn create_local_package_in(pkgid: &PkgId, pkgdir: &Path) -> Path { os::path_is_dir(&package_dir)); // Create main, lib, test, and bench files - writeFile(&package_dir.join_str("main.rs"), + writeFile(&package_dir.join("main.rs"), "fn main() { let _x = (); }"); - writeFile(&package_dir.join_str("lib.rs"), + writeFile(&package_dir.join("lib.rs"), "pub fn f() { let _x = (); }"); - writeFile(&package_dir.join_str("test.rs"), + writeFile(&package_dir.join("test.rs"), "#[test] pub fn f() { (); }"); - writeFile(&package_dir.join_str("bench.rs"), + writeFile(&package_dir.join("bench.rs"), "#[bench] pub fn f() { (); }"); package_dir } @@ -356,11 +356,11 @@ fn create_local_package_with_dep(pkgid: &PkgId, subord_pkgid: &PkgId) -> TempDir let package_dir = create_local_package(pkgid); create_local_package_in(subord_pkgid, package_dir.path()); // Write a main.rs file into pkgid that references subord_pkgid - writeFile(&package_dir.path().join_many_str([~"src", pkgid.to_str(), ~"main.rs"]), + writeFile(&package_dir.path().join_many([~"src", pkgid.to_str(), ~"main.rs"]), format!("extern mod {};\nfn main() \\{\\}", subord_pkgid.short_name)); // Write a lib.rs file into subord_pkgid that has something in it - writeFile(&package_dir.path().join_many_str([~"src", subord_pkgid.to_str(), ~"lib.rs"]), + writeFile(&package_dir.path().join_many([~"src", subord_pkgid.to_str(), ~"lib.rs"]), "pub fn f() {}"); package_dir } @@ -452,7 +452,7 @@ fn llvm_bitcode_file_exists(repo: &Path, short_name: &str) -> bool { } fn file_exists(repo: &Path, short_name: &str, extension: &str) -> bool { - os::path_exists(&target_build_dir(repo).join_many_str([short_name.to_owned(), + os::path_exists(&target_build_dir(repo).join_many([short_name.to_owned(), format!("{}.{}", short_name, extension)])) } @@ -497,7 +497,7 @@ fn command_line_test_output_with_env(args: &[~str], env: ~[(~str, ~str)]) -> ~[~ fn lib_output_file_name(workspace: &Path, short_name: &str) -> Path { debug2!("lib_output_file_name: given {} and short name {}", workspace.display(), short_name); - library_in_workspace(&Path::from_str(short_name), + library_in_workspace(&Path::new(short_name), short_name, Build, workspace, @@ -506,13 +506,13 @@ fn lib_output_file_name(workspace: &Path, short_name: &str) -> Path { } fn output_file_name(workspace: &Path, short_name: ~str) -> Path { - target_build_dir(workspace).join_str(short_name).join_str(format!("{}{}", short_name, - os::EXE_SUFFIX)) + target_build_dir(workspace).join(short_name.as_slice()).join(format!("{}{}", short_name, + os::EXE_SUFFIX)) } fn touch_source_file(workspace: &Path, pkgid: &PkgId) { use conditions::bad_path::cond; - let pkg_src_dir = workspace.join_many_str([~"src", pkgid.to_str()]); + let pkg_src_dir = workspace.join_many([~"src", pkgid.to_str()]); let contents = os::list_dir_path(&pkg_src_dir); for p in contents.iter() { if p.extension_str() == Some("rs") { @@ -528,9 +528,9 @@ fn touch_source_file(workspace: &Path, pkgid: &PkgId) { /// Add a comment at the end fn frob_source_file(workspace: &Path, pkgid: &PkgId, filename: &str) { use conditions::bad_path::cond; - let pkg_src_dir = workspace.join_many_str([~"src", pkgid.to_str()]); + let pkg_src_dir = workspace.join_many([~"src", pkgid.to_str()]); let mut maybe_p = None; - let maybe_file = pkg_src_dir.join_str(filename); + let maybe_file = pkg_src_dir.join(filename); debug2!("Trying to frob {} -- {}", pkg_src_dir.display(), filename); if os::path_exists(&maybe_file) { maybe_p = Some(maybe_file); @@ -552,7 +552,7 @@ fn frob_source_file(workspace: &Path, pkgid: &PkgId, filename: &str) { #[test] fn test_make_dir_rwx() { let temp = &os::tmpdir(); - let dir = temp.join_str("quux"); + let dir = temp.join("quux"); assert!(!os::path_exists(&dir) || os::remove_dir_recursive(&dir)); debug2!("Trying to make {}", dir.display()); @@ -630,16 +630,16 @@ fn test_install_git() { let repo = init_git_repo(&temp_pkg_id.path); let repo = repo.path(); debug2!("repo = {}", repo.display()); - let repo_subdir = repo.join_many_str(["mockgithub.com", "catamorphism", "test-pkg"]); + let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test-pkg"]); debug2!("repo_subdir = {}", repo_subdir.display()); - writeFile(&repo_subdir.join_str("main.rs"), + writeFile(&repo_subdir.join("main.rs"), "fn main() { let _x = (); }"); - writeFile(&repo_subdir.join_str("lib.rs"), + writeFile(&repo_subdir.join("lib.rs"), "pub fn f() { let _x = (); }"); - writeFile(&repo_subdir.join_str("test.rs"), + writeFile(&repo_subdir.join("test.rs"), "#[test] pub fn f() { (); }"); - writeFile(&repo_subdir.join_str("bench.rs"), + writeFile(&repo_subdir.join("bench.rs"), "#[bench] pub fn f() { (); }"); add_git_tag(&repo_subdir, ~"0.1"); // this has the effect of committing the files @@ -648,7 +648,7 @@ fn test_install_git() { // should have test, bench, lib, and main // FIXME (#9639): This needs to handle non-utf8 paths command_line_test([~"install", temp_pkg_id.path.as_str().unwrap().to_owned()], repo); - let ws = repo.join_str(".rust"); + let ws = repo.join(".rust"); // Check that all files exist debug2!("Checking for files in {}", ws.display()); let exec = target_executable_in_workspace(&temp_pkg_id, &ws); @@ -705,12 +705,12 @@ fn test_package_ids_must_be_relative_path_like() { } do cond.trap(|(p, e)| { - let abs = os::make_absolute(&Path::from_str("foo/bar/quux")); + let abs = os::make_absolute(&Path::new("foo/bar/quux")); assert_eq!(p, abs); assert!("absolute pkgid" == e); whatever.clone() }).inside { - let zp = os::make_absolute(&Path::from_str("foo/bar/quux")); + let zp = os::make_absolute(&Path::new("foo/bar/quux")); // FIXME (#9639): This needs to handle non-utf8 paths let z = PkgId::new(zp.as_str().unwrap()); assert_eq!(~"foo-0.1", z.to_str()); @@ -721,17 +721,17 @@ fn test_package_ids_must_be_relative_path_like() { #[test] fn test_package_version() { let local_path = "mockgithub.com/catamorphism/test_pkg_version"; - let repo = init_git_repo(&Path::from_str(local_path)); + let repo = init_git_repo(&Path::new(local_path)); let repo = repo.path(); - let repo_subdir = repo.join_many_str(["mockgithub.com", "catamorphism", "test_pkg_version"]); + let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test_pkg_version"]); debug2!("Writing files in: {}", repo_subdir.display()); - writeFile(&repo_subdir.join_str("main.rs"), + writeFile(&repo_subdir.join("main.rs"), "fn main() { let _x = (); }"); - writeFile(&repo_subdir.join_str("lib.rs"), + writeFile(&repo_subdir.join("lib.rs"), "pub fn f() { let _x = (); }"); - writeFile(&repo_subdir.join_str("test.rs"), + writeFile(&repo_subdir.join("test.rs"), "#[test] pub fn f() { (); }"); - writeFile(&repo_subdir.join_str("bench.rs"), + writeFile(&repo_subdir.join("bench.rs"), "#[bench] pub fn f() { (); }"); add_git_tag(&repo_subdir, ~"0.4"); @@ -740,7 +740,7 @@ fn test_package_version() { // This should look at the prefix, clone into a workspace, then build. command_line_test([~"install", ~"mockgithub.com/catamorphism/test_pkg_version"], repo); - let ws = repo.join_str(".rust"); + let ws = repo.join(".rust"); // we can still match on the filename to make sure it contains the 0.4 version assert!(match built_library_in_workspace(&temp_pkg_id, &ws) { @@ -751,36 +751,36 @@ fn test_package_version() { None => false }); assert!(built_executable_in_workspace(&temp_pkg_id, &ws) - == Some(target_build_dir(&ws).join_many_str(["mockgithub.com", - "catamorphism", - "test_pkg_version", - "test_pkg_version"]))); + == Some(target_build_dir(&ws).join_many(["mockgithub.com", + "catamorphism", + "test_pkg_version", + "test_pkg_version"]))); } #[test] fn test_package_request_version() { let local_path = "mockgithub.com/catamorphism/test_pkg_version"; - let repo = init_git_repo(&Path::from_str(local_path)); + let repo = init_git_repo(&Path::new(local_path)); let repo = repo.path(); - let repo_subdir = repo.join_many_str(["mockgithub.com", "catamorphism", "test_pkg_version"]); + let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test_pkg_version"]); debug2!("Writing files in: {}", repo_subdir.display()); - writeFile(&repo_subdir.join_str("main.rs"), + writeFile(&repo_subdir.join("main.rs"), "fn main() { let _x = (); }"); - writeFile(&repo_subdir.join_str("lib.rs"), + writeFile(&repo_subdir.join("lib.rs"), "pub fn f() { let _x = (); }"); - writeFile(&repo_subdir.join_str("test.rs"), + writeFile(&repo_subdir.join("test.rs"), "#[test] pub fn f() { (); }"); - writeFile(&repo_subdir.join_str("bench.rs"), + writeFile(&repo_subdir.join("bench.rs"), "#[bench] pub fn f() { (); }"); - writeFile(&repo_subdir.join_str("version-0.3-file.txt"), "hi"); + writeFile(&repo_subdir.join("version-0.3-file.txt"), "hi"); add_git_tag(&repo_subdir, ~"0.3"); - writeFile(&repo_subdir.join_str("version-0.4-file.txt"), "hello"); + writeFile(&repo_subdir.join("version-0.4-file.txt"), "hello"); add_git_tag(&repo_subdir, ~"0.4"); command_line_test([~"install", format!("{}\\#0.3", local_path)], repo); - assert!(match installed_library_in_workspace(&Path::from_str("test_pkg_version"), - &repo.join_str(".rust")) { + assert!(match installed_library_in_workspace(&Path::new("test_pkg_version"), + &repo.join(".rust")) { Some(p) => { debug2!("installed: {}", p.display()); let suffix = format!("0.3{}", os::consts::DLL_SUFFIX); @@ -789,15 +789,15 @@ fn test_package_request_version() { None => false }); let temp_pkg_id = PkgId::new("mockgithub.com/catamorphism/test_pkg_version#0.3"); - assert!(target_executable_in_workspace(&temp_pkg_id, &repo.join_str(".rust")) - == repo.join_many_str([".rust", "bin", "test_pkg_version"])); + assert!(target_executable_in_workspace(&temp_pkg_id, &repo.join(".rust")) + == repo.join_many([".rust", "bin", "test_pkg_version"])); - let mut dir = target_build_dir(&repo.join_str(".rust")); - dir.push_path(&Path::from_str("src/mockgithub.com/catamorphism/test_pkg_version-0.3")); + let mut dir = target_build_dir(&repo.join(".rust")); + dir.push_path(&Path::new("src/mockgithub.com/catamorphism/test_pkg_version-0.3")); debug2!("dir = {}", dir.display()); assert!(os::path_is_dir(&dir)); - assert!(os::path_exists(&dir.join_str("version-0.3-file.txt"))); - assert!(!os::path_exists(&dir.join_str("version-0.4-file.txt"))); + assert!(os::path_exists(&dir.join("version-0.3-file.txt"))); + assert!(!os::path_exists(&dir.join("version-0.4-file.txt"))); } #[test] @@ -810,23 +810,23 @@ fn rustpkg_install_url_2() { #[test] fn rustpkg_library_target() { - let foo_repo = init_git_repo(&Path::from_str("foo")); + let foo_repo = init_git_repo(&Path::new("foo")); let foo_repo = foo_repo.path(); - let package_dir = foo_repo.join_str("foo"); + let package_dir = foo_repo.join("foo"); debug2!("Writing files in: {}", package_dir.display()); - writeFile(&package_dir.join_str("main.rs"), + writeFile(&package_dir.join("main.rs"), "fn main() { let _x = (); }"); - writeFile(&package_dir.join_str("lib.rs"), + writeFile(&package_dir.join("lib.rs"), "pub fn f() { let _x = (); }"); - writeFile(&package_dir.join_str("test.rs"), + writeFile(&package_dir.join("test.rs"), "#[test] pub fn f() { (); }"); - writeFile(&package_dir.join_str("bench.rs"), + writeFile(&package_dir.join("bench.rs"), "#[bench] pub fn f() { (); }"); add_git_tag(&package_dir, ~"1.0"); command_line_test([~"install", ~"foo"], foo_repo); - assert_lib_exists(&foo_repo.join_str(".rust"), &Path::from_str("foo"), ExactRevision(~"1.0")); + assert_lib_exists(&foo_repo.join(".rust"), &Path::new("foo"), ExactRevision(~"1.0")); } #[test] @@ -844,26 +844,25 @@ fn package_script_with_default_build() { debug2!("dir = {}", dir.display()); let mut source = test_sysroot().dir_path(); source.pop(); source.pop(); - source.push_many_str( - ["src", "librustpkg", "testsuite", "pass", "src", "fancy-lib", "pkg.rs"]); + source.push_many(["src", "librustpkg", "testsuite", "pass", "src", "fancy-lib", "pkg.rs"]); debug2!("package_script_with_default_build: {}", source.display()); if !os::copy_file(&source, - &dir.join_many_str(["src", "fancy-lib-0.1", "pkg.rs"])) { + &dir.join_many(["src", "fancy-lib-0.1", "pkg.rs"])) { fail2!("Couldn't copy file"); } command_line_test([~"install", ~"fancy-lib"], dir); - assert_lib_exists(dir, &Path::from_str("fancy-lib"), NoVersion); - assert!(os::path_exists(&target_build_dir(dir).join_many_str(["fancy-lib", "generated.rs"]))); + assert_lib_exists(dir, &Path::new("fancy-lib"), NoVersion); + assert!(os::path_exists(&target_build_dir(dir).join_many(["fancy-lib", "generated.rs"]))); } #[test] fn rustpkg_build_no_arg() { let tmp = TempDir::new("rustpkg_build_no_arg").expect("rustpkg_build_no_arg failed"); - let tmp = tmp.path().join_str(".rust"); - let package_dir = tmp.join_many_str(["src", "foo"]); + let tmp = tmp.path().join(".rust"); + let package_dir = tmp.join_many(["src", "foo"]); assert!(os::mkdir_recursive(&package_dir, U_RWX)); - writeFile(&package_dir.join_str("main.rs"), + writeFile(&package_dir.join("main.rs"), "fn main() { let _x = (); }"); debug2!("build_no_arg: dir = {}", package_dir.display()); command_line_test([~"build"], &package_dir); @@ -873,24 +872,24 @@ fn rustpkg_build_no_arg() { #[test] fn rustpkg_install_no_arg() { let tmp = TempDir::new("rustpkg_install_no_arg").expect("rustpkg_install_no_arg failed"); - let tmp = tmp.path().join_str(".rust"); - let package_dir = tmp.join_many_str(["src", "foo"]); + let tmp = tmp.path().join(".rust"); + let package_dir = tmp.join_many(["src", "foo"]); assert!(os::mkdir_recursive(&package_dir, U_RWX)); - writeFile(&package_dir.join_str("lib.rs"), + writeFile(&package_dir.join("lib.rs"), "fn main() { let _x = (); }"); debug2!("install_no_arg: dir = {}", package_dir.display()); command_line_test([~"install"], &package_dir); - assert_lib_exists(&tmp, &Path::from_str("foo"), NoVersion); + assert_lib_exists(&tmp, &Path::new("foo"), NoVersion); } #[test] fn rustpkg_clean_no_arg() { let tmp = TempDir::new("rustpkg_clean_no_arg").expect("rustpkg_clean_no_arg failed"); - let tmp = tmp.path().join_str(".rust"); - let package_dir = tmp.join_many_str(["src", "foo"]); + let tmp = tmp.path().join(".rust"); + let package_dir = tmp.join_many(["src", "foo"]); assert!(os::mkdir_recursive(&package_dir, U_RWX)); - writeFile(&package_dir.join_str("main.rs"), + writeFile(&package_dir.join("main.rs"), "fn main() { let _x = (); }"); debug2!("clean_no_arg: dir = {}", package_dir.display()); command_line_test([~"build"], &package_dir); @@ -903,9 +902,9 @@ fn rustpkg_clean_no_arg() { #[test] fn rust_path_test() { let dir_for_path = TempDir::new("more_rust").expect("rust_path_test failed"); - let dir = mk_workspace(dir_for_path.path(), &Path::from_str("foo"), &NoVersion); + let dir = mk_workspace(dir_for_path.path(), &Path::new("foo"), &NoVersion); debug2!("dir = {}", dir.display()); - writeFile(&dir.join_str("main.rs"), "fn main() { let _x = (); }"); + writeFile(&dir.join("main.rs"), "fn main() { let _x = (); }"); let cwd = os::getcwd(); debug2!("cwd = {}", cwd.display()); @@ -921,16 +920,16 @@ fn rust_path_test() { #[ignore] // FIXME(#9184) tests can't change the cwd (other tests are sad then) fn rust_path_contents() { let dir = TempDir::new("rust_path").expect("rust_path_contents failed"); - let abc = &dir.path().join_many_str(["A", "B", "C"]); - assert!(os::mkdir_recursive(&abc.join_str(".rust"), U_RWX)); + let abc = &dir.path().join_many(["A", "B", "C"]); + assert!(os::mkdir_recursive(&abc.join(".rust"), U_RWX)); assert!(os::mkdir_recursive(&abc.with_filename(".rust"), U_RWX)); assert!(os::mkdir_recursive(&abc.dir_path().with_filename(".rust"), U_RWX)); assert!(os::change_dir(abc)); let p = rust_path(); - let cwd = os::getcwd().join_str(".rust"); - let parent = cwd.dir_path().with_filename_str(".rust"); - let grandparent = cwd.dir_path().dir_path().with_filename_str(".rust"); + let cwd = os::getcwd().join(".rust"); + let parent = cwd.dir_path().with_filename(".rust"); + let grandparent = cwd.dir_path().dir_path().with_filename(".rust"); assert!(p.contains(&cwd)); assert!(p.contains(&parent)); assert!(p.contains(&grandparent)); @@ -943,9 +942,9 @@ fn rust_path_contents() { fn rust_path_parse() { os::setenv("RUST_PATH", "/a/b/c:/d/e/f:/g/h/i"); let paths = rust_path(); - assert!(paths.contains(&Path::from_str("/g/h/i"))); - assert!(paths.contains(&Path::from_str("/d/e/f"))); - assert!(paths.contains(&Path::from_str("/a/b/c"))); + assert!(paths.contains(&Path::new("/g/h/i"))); + assert!(paths.contains(&Path::new("/d/e/f"))); + assert!(paths.contains(&Path::new("/a/b/c"))); os::unsetenv("RUST_PATH"); } @@ -1144,23 +1143,21 @@ fn test_non_numeric_tag() { let temp_pkg_id = git_repo_pkg(); let repo = init_git_repo(&temp_pkg_id.path); let repo = repo.path(); - let repo_subdir = repo.join_many_str(["mockgithub.com", "catamorphism", "test-pkg"]); - writeFile(&repo_subdir.join_str("foo"), "foo"); - writeFile(&repo_subdir.join_str("lib.rs"), + let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test-pkg"]); + writeFile(&repo_subdir.join("foo"), "foo"); + writeFile(&repo_subdir.join("lib.rs"), "pub fn f() { let _x = (); }"); add_git_tag(&repo_subdir, ~"testbranch"); - writeFile(&repo_subdir.join_str("testbranch_only"), "hello"); + writeFile(&repo_subdir.join("testbranch_only"), "hello"); add_git_tag(&repo_subdir, ~"another_tag"); - writeFile(&repo_subdir.join_str("not_on_testbranch_only"), "bye bye"); + writeFile(&repo_subdir.join("not_on_testbranch_only"), "bye bye"); add_all_and_commit(&repo_subdir); // FIXME (#9639): This needs to handle non-utf8 paths command_line_test([~"install", format!("{}\\#testbranch", temp_pkg_id.path.as_str().unwrap())], repo); - let file1 = repo.join_many_str(["mockgithub.com", "catamorphism", - "test-pkg", "testbranch_only"]); - let file2 = repo.join_many_str(["mockgithub.com", "catamorphism", "test-pkg", - "master_only"]); + let file1 = repo.join_many(["mockgithub.com", "catamorphism", "test-pkg", "testbranch_only"]); + let file2 = repo.join_many(["mockgithub.com", "catamorphism", "test-pkg", "master_only"]); assert!(os::path_exists(&file1)); assert!(!os::path_exists(&file2)); } @@ -1169,13 +1166,12 @@ fn test_non_numeric_tag() { fn test_extern_mod() { let dir = TempDir::new("test_extern_mod").expect("test_extern_mod"); let dir = dir.path(); - let main_file = dir.join_str("main.rs"); + let main_file = dir.join("main.rs"); let lib_depend_dir = TempDir::new("foo").expect("test_extern_mod"); let lib_depend_dir = lib_depend_dir.path(); - let aux_dir = lib_depend_dir.join_many_str(["src", "mockgithub.com", "catamorphism", - "test_pkg"]); + let aux_dir = lib_depend_dir.join_many(["src", "mockgithub.com", "catamorphism", "test_pkg"]); assert!(os::mkdir_recursive(&aux_dir, U_RWX)); - let aux_pkg_file = aux_dir.join_str("lib.rs"); + let aux_pkg_file = aux_dir.join("lib.rs"); writeFile(&aux_pkg_file, "pub mod bar { pub fn assert_true() { assert!(true); } }\n"); assert!(os::path_exists(&aux_pkg_file)); @@ -1186,12 +1182,12 @@ fn test_extern_mod() { command_line_test([~"install", ~"mockgithub.com/catamorphism/test_pkg"], lib_depend_dir); - let exec_file = dir.join_str("out"); + let exec_file = dir.join("out"); // Be sure to extend the existing environment // FIXME (#9639): This needs to handle non-utf8 paths let env = Some([(~"RUST_PATH", lib_depend_dir.as_str().unwrap().to_owned())] + os::env()); let rustpkg_exec = rustpkg_exec(); - let rustc = rustpkg_exec.with_filename_str("rustc"); + let rustc = rustpkg_exec.with_filename("rustc"); let test_sys = test_sysroot(); // FIXME (#9639): This needs to handle non-utf8 paths @@ -1219,12 +1215,12 @@ fn test_extern_mod() { fn test_extern_mod_simpler() { let dir = TempDir::new("test_extern_mod_simpler").expect("test_extern_mod_simpler"); let dir = dir.path(); - let main_file = dir.join_str("main.rs"); + let main_file = dir.join("main.rs"); let lib_depend_dir = TempDir::new("foo").expect("test_extern_mod_simpler"); let lib_depend_dir = lib_depend_dir.path(); - let aux_dir = lib_depend_dir.join_many_str(["src", "rust-awesomeness"]); + let aux_dir = lib_depend_dir.join_many(["src", "rust-awesomeness"]); assert!(os::mkdir_recursive(&aux_dir, U_RWX)); - let aux_pkg_file = aux_dir.join_str("lib.rs"); + let aux_pkg_file = aux_dir.join("lib.rs"); writeFile(&aux_pkg_file, "pub mod bar { pub fn assert_true() { assert!(true); } }\n"); assert!(os::path_exists(&aux_pkg_file)); @@ -1235,12 +1231,12 @@ fn test_extern_mod_simpler() { command_line_test([~"install", ~"rust-awesomeness"], lib_depend_dir); - let exec_file = dir.join_str("out"); + let exec_file = dir.join("out"); // Be sure to extend the existing environment // FIXME (#9639): This needs to handle non-utf8 paths let env = Some([(~"RUST_PATH", lib_depend_dir.as_str().unwrap().to_owned())] + os::env()); let rustpkg_exec = rustpkg_exec(); - let rustc = rustpkg_exec.with_filename_str("rustc"); + let rustc = rustpkg_exec.with_filename("rustc"); let test_sys = test_sysroot(); debug2!("RUST_PATH={} {} {} \n --sysroot {} -o {}", lib_depend_dir.display(), @@ -1275,11 +1271,11 @@ fn test_import_rustpkg() { let p_id = PkgId::new("foo"); let workspace = create_local_package(&p_id); let workspace = workspace.path(); - writeFile(&workspace.join_many_str(["src", "foo-0.1", "pkg.rs"]), + writeFile(&workspace.join_many(["src", "foo-0.1", "pkg.rs"]), "extern mod rustpkg; fn main() {}"); command_line_test([~"build", ~"foo"], workspace); debug2!("workspace = {}", workspace.display()); - assert!(os::path_exists(&target_build_dir(workspace).join_str("foo").join_str(format!("pkg{}", + assert!(os::path_exists(&target_build_dir(workspace).join("foo").join(format!("pkg{}", os::EXE_SUFFIX)))); } @@ -1288,11 +1284,11 @@ fn test_macro_pkg_script() { let p_id = PkgId::new("foo"); let workspace = create_local_package(&p_id); let workspace = workspace.path(); - writeFile(&workspace.join_many_str(["src", "foo-0.1", "pkg.rs"]), + writeFile(&workspace.join_many(["src", "foo-0.1", "pkg.rs"]), "extern mod rustpkg; fn main() { debug2!(\"Hi\"); }"); command_line_test([~"build", ~"foo"], workspace); debug2!("workspace = {}", workspace.display()); - assert!(os::path_exists(&target_build_dir(workspace).join_str("foo").join_str(format!("pkg{}", + assert!(os::path_exists(&target_build_dir(workspace).join("foo").join(format!("pkg{}", os::EXE_SUFFIX)))); } @@ -1302,8 +1298,8 @@ fn multiple_workspaces() { // Copy the exact same package into directory B and install it // Set the RUST_PATH to A:B // Make a third package that uses foo, make sure we can build/install it - let (a_loc, _pkg_dir) = mk_temp_workspace(&Path::from_str("foo"), &NoVersion); - let (b_loc, _pkg_dir) = mk_temp_workspace(&Path::from_str("foo"), &NoVersion); + let (a_loc, _pkg_dir) = mk_temp_workspace(&Path::new("foo"), &NoVersion); + let (b_loc, _pkg_dir) = mk_temp_workspace(&Path::new("foo"), &NoVersion); let (a_loc, b_loc) = (a_loc.path(), b_loc.path()); debug2!("Trying to install foo in {}", a_loc.display()); command_line_test([~"install", ~"foo"], a_loc); @@ -1328,7 +1324,7 @@ fn rust_path_hack_test(hack_flag: bool) { let p_id = PkgId::new("foo"); let workspace = create_local_package(&p_id); let workspace = workspace.path(); - let dest_workspace = mk_empty_workspace(&Path::from_str("bar"), &NoVersion, "dest_workspace"); + let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace"); let dest_workspace = dest_workspace.path(); let rust_path = Some(~[(~"RUST_PATH", format!("{}:{}", @@ -1336,11 +1332,11 @@ fn rust_path_hack_test(hack_flag: bool) { foo_path.as_str().unwrap()))]); command_line_test_with_env(~[~"install"] + if hack_flag { ~[~"--rust-path-hack"] } else { ~[] } + ~[~"foo"], dest_workspace, rust_path); - assert_lib_exists(dest_workspace, &Path::from_str("foo"), NoVersion); + assert_lib_exists(dest_workspace, &Path::new("foo"), NoVersion); assert_executable_exists(dest_workspace, "foo"); assert_built_library_exists(dest_workspace, "foo"); assert_built_executable_exists(dest_workspace, "foo"); - assert!(!lib_exists(workspace, &Path::from_str("foo"), NoVersion)); + assert!(!lib_exists(workspace, &Path::new("foo"), NoVersion)); assert!(!executable_exists(workspace, "foo")); assert!(!built_library_exists(workspace, "foo")); assert!(!built_executable_exists(workspace, "foo")); @@ -1369,19 +1365,19 @@ fn test_rust_path_can_contain_package_dirs_without_flag() { fn rust_path_hack_cwd() { // Same as rust_path_hack_test, but the CWD is the dir to build out of let cwd = TempDir::new("foo").expect("rust_path_hack_cwd"); - let cwd = cwd.path().join_str("foo"); + let cwd = cwd.path().join("foo"); assert!(os::mkdir_recursive(&cwd, U_RWX)); - writeFile(&cwd.join_str("lib.rs"), "pub fn f() { }"); + writeFile(&cwd.join("lib.rs"), "pub fn f() { }"); - let dest_workspace = mk_empty_workspace(&Path::from_str("bar"), &NoVersion, "dest_workspace"); + let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace"); let dest_workspace = dest_workspace.path(); // FIXME (#9639): This needs to handle non-utf8 paths let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]); command_line_test_with_env([~"install", ~"--rust-path-hack", ~"foo"], &cwd, rust_path); debug2!("Checking that foo exists in {}", dest_workspace.display()); - assert_lib_exists(dest_workspace, &Path::from_str("foo"), NoVersion); + assert_lib_exists(dest_workspace, &Path::new("foo"), NoVersion); assert_built_library_exists(dest_workspace, "foo"); - assert!(!lib_exists(&cwd, &Path::from_str("foo"), NoVersion)); + assert!(!lib_exists(&cwd, &Path::new("foo"), NoVersion)); assert!(!built_library_exists(&cwd, "foo")); } @@ -1389,20 +1385,20 @@ fn rust_path_hack_cwd() { fn rust_path_hack_multi_path() { // Same as rust_path_hack_test, but with a more complex package ID let cwd = TempDir::new("pkg_files").expect("rust_path_hack_cwd"); - let subdir = cwd.path().join_many_str(["foo", "bar", "quux"]); + let subdir = cwd.path().join_many(["foo", "bar", "quux"]); assert!(os::mkdir_recursive(&subdir, U_RWX)); - writeFile(&subdir.join_str("lib.rs"), "pub fn f() { }"); + writeFile(&subdir.join("lib.rs"), "pub fn f() { }"); let name = ~"foo/bar/quux"; - let dest_workspace = mk_empty_workspace(&Path::from_str("bar"), &NoVersion, "dest_workspace"); + let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace"); let dest_workspace = dest_workspace.path(); // FIXME (#9639): This needs to handle non-utf8 paths let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]); command_line_test_with_env([~"install", ~"--rust-path-hack", name.clone()], &subdir, rust_path); debug2!("Checking that {} exists in {}", name, dest_workspace.display()); - assert_lib_exists(dest_workspace, &Path::from_str("quux"), NoVersion); + assert_lib_exists(dest_workspace, &Path::new("quux"), NoVersion); assert_built_library_exists(dest_workspace, name); - assert!(!lib_exists(&subdir, &Path::from_str("quux"), NoVersion)); + assert!(!lib_exists(&subdir, &Path::new("quux"), NoVersion)); assert!(!built_library_exists(&subdir, name)); } @@ -1411,19 +1407,19 @@ fn rust_path_hack_install_no_arg() { // Same as rust_path_hack_cwd, but making rustpkg infer the pkg id let cwd = TempDir::new("pkg_files").expect("rust_path_hack_install_no_arg"); let cwd = cwd.path(); - let source_dir = cwd.join_str("foo"); + let source_dir = cwd.join("foo"); assert!(make_dir_rwx(&source_dir)); - writeFile(&source_dir.join_str("lib.rs"), "pub fn f() { }"); + writeFile(&source_dir.join("lib.rs"), "pub fn f() { }"); - let dest_workspace = mk_empty_workspace(&Path::from_str("bar"), &NoVersion, "dest_workspace"); + let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace"); let dest_workspace = dest_workspace.path(); // FIXME (#9639): This needs to handle non-utf8 paths let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]); command_line_test_with_env([~"install", ~"--rust-path-hack"], &source_dir, rust_path); debug2!("Checking that foo exists in {}", dest_workspace.display()); - assert_lib_exists(dest_workspace, &Path::from_str("foo"), NoVersion); + assert_lib_exists(dest_workspace, &Path::new("foo"), NoVersion); assert_built_library_exists(dest_workspace, "foo"); - assert!(!lib_exists(&source_dir, &Path::from_str("foo"), NoVersion)); + assert!(!lib_exists(&source_dir, &Path::new("foo"), NoVersion)); assert!(!built_library_exists(cwd, "foo")); } @@ -1431,11 +1427,11 @@ fn rust_path_hack_install_no_arg() { fn rust_path_hack_build_no_arg() { // Same as rust_path_hack_install_no_arg, but building instead of installing let cwd = TempDir::new("pkg_files").expect("rust_path_hack_build_no_arg"); - let source_dir = cwd.path().join_str("foo"); + let source_dir = cwd.path().join("foo"); assert!(make_dir_rwx(&source_dir)); - writeFile(&source_dir.join_str("lib.rs"), "pub fn f() { }"); + writeFile(&source_dir.join("lib.rs"), "pub fn f() { }"); - let dest_workspace = mk_empty_workspace(&Path::from_str("bar"), &NoVersion, "dest_workspace"); + let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace"); let dest_workspace = dest_workspace.path(); // FIXME (#9639): This needs to handle non-utf8 paths let rust_path = Some(~[(~"RUST_PATH", dest_workspace.as_str().unwrap().to_owned())]); @@ -1449,9 +1445,9 @@ fn rust_path_hack_build_no_arg() { fn rust_path_install_target() { let dir_for_path = TempDir::new( "source_workspace").expect("rust_path_install_target failed"); - let mut dir = mk_workspace(dir_for_path.path(), &Path::from_str("foo"), &NoVersion); + let mut dir = mk_workspace(dir_for_path.path(), &Path::new("foo"), &NoVersion); debug2!("dir = {}", dir.display()); - writeFile(&dir.join_str("main.rs"), "fn main() { let _x = (); }"); + writeFile(&dir.join("main.rs"), "fn main() { let _x = (); }"); let dir_to_install_to = TempDir::new( "dest_workspace").expect("rust_path_install_target failed"); let dir_to_install_to = dir_to_install_to.path(); @@ -1561,7 +1557,7 @@ fn notrans_flag_fail() { workspace, None, BAD_FLAG_CODE); assert!(!built_executable_exists(workspace, "foo")); assert!(!object_file_exists(workspace, "foo")); - assert!(!lib_exists(workspace, &Path::from_str("foo"), NoVersion)); + assert!(!lib_exists(workspace, &Path::new("foo"), NoVersion)); } } @@ -1605,7 +1601,7 @@ fn test_cfg_build() { let workspace = create_local_package(&p_id); let workspace = workspace.path(); // If the cfg flag gets messed up, this won't compile - writeFile(&workspace.join_many_str(["src", "foo-0.1", "main.rs"]), + writeFile(&workspace.join_many(["src", "foo-0.1", "main.rs"]), "#[cfg(quux)] fn main() {}"); let test_sys = test_sysroot(); // FIXME (#9639): This needs to handle non-utf8 paths @@ -1623,7 +1619,7 @@ fn test_cfg_fail() { let p_id = PkgId::new("foo"); let workspace = create_local_package(&p_id); let workspace = workspace.path(); - writeFile(&workspace.join_many_str(["src", "foo-0.1", "main.rs"]), + writeFile(&workspace.join_many(["src", "foo-0.1", "main.rs"]), "#[cfg(quux)] fn main() {}"); let test_sys = test_sysroot(); // FIXME (#9639): This needs to handle non-utf8 paths @@ -1780,23 +1776,23 @@ fn pkgid_pointing_to_subdir() { // rustpkg should recognize that and treat the part after some_repo/ as a subdir let workspace = TempDir::new("parent_repo").expect("Couldn't create temp dir"); let workspace = workspace.path(); - assert!(os::mkdir_recursive(&workspace.join_many_str(["src", "mockgithub.com", - "mozilla", "some_repo"]), U_RWX)); + assert!(os::mkdir_recursive(&workspace.join_many(["src", "mockgithub.com", + "mozilla", "some_repo"]), U_RWX)); - let foo_dir = workspace.join_many_str(["src", "mockgithub.com", "mozilla", "some_repo", - "extras", "foo"]); - let bar_dir = workspace.join_many_str(["src", "mockgithub.com", "mozilla", "some_repo", - "extras", "bar"]); + let foo_dir = workspace.join_many(["src", "mockgithub.com", "mozilla", "some_repo", + "extras", "foo"]); + let bar_dir = workspace.join_many(["src", "mockgithub.com", "mozilla", "some_repo", + "extras", "bar"]); assert!(os::mkdir_recursive(&foo_dir, U_RWX)); assert!(os::mkdir_recursive(&bar_dir, U_RWX)); - writeFile(&foo_dir.join_str("lib.rs"), "pub fn f() {}"); - writeFile(&bar_dir.join_str("lib.rs"), "pub fn g() {}"); + writeFile(&foo_dir.join("lib.rs"), "pub fn f() {}"); + writeFile(&bar_dir.join("lib.rs"), "pub fn g() {}"); debug2!("Creating a file in {}", workspace.display()); - let testpkg_dir = workspace.join_many_str(["src", "testpkg-0.1"]); + let testpkg_dir = workspace.join_many(["src", "testpkg-0.1"]); assert!(os::mkdir_recursive(&testpkg_dir, U_RWX)); - writeFile(&testpkg_dir.join_str("main.rs"), + writeFile(&testpkg_dir.join("main.rs"), "extern mod foo = \"mockgithub.com/mozilla/some_repo/extras/foo\";\n extern mod bar = \"mockgithub.com/mozilla/some_repo/extras/bar\";\n use foo::f; use bar::g; \n @@ -1813,13 +1809,13 @@ fn test_recursive_deps() { let c_id = PkgId::new("c"); let b_workspace = create_local_package_with_dep(&b_id, &c_id); let b_workspace = b_workspace.path(); - writeFile(&b_workspace.join_many_str(["src", "c-0.1", "lib.rs"])), + writeFile(&b_workspace.join_many(["src", "c-0.1", "lib.rs"])), "pub fn g() {}"); let a_workspace = create_local_package(&a_id); let a_workspace = a_workspace.path(); - writeFile(&a_workspace.join_many_str(["src", "a-0.1", "main.rs"]), + writeFile(&a_workspace.join_many(["src", "a-0.1", "main.rs"]), "extern mod b; use b::f; fn main() { f(); }"); - writeFile(&b_workspace.join_many_str(["src", "b-0.1", "lib.rs"]), + writeFile(&b_workspace.join_many(["src", "b-0.1", "lib.rs"]), "extern mod c; use c::g; pub fn f() { g(); }"); // FIXME (#9639): This needs to handle non-utf8 paths let environment = Some(~[(~"RUST_PATH", b_workspace.as_str().unwrap().to_owned())]); @@ -1827,9 +1823,9 @@ fn test_recursive_deps() { command_line_test_with_env([~"install", ~"a"], a_workspace, environment); - assert_lib_exists(a_workspace, &Path::from_str("a"), NoVersion); - assert_lib_exists(b_workspace, &Path::from_str("b"), NoVersion); - assert_lib_exists(b_workspace, &Path::from_str("c"), NoVersion); + assert_lib_exists(a_workspace, &Path::new("a"), NoVersion); + assert_lib_exists(b_workspace, &Path::new("b"), NoVersion); + assert_lib_exists(b_workspace, &Path::new("c"), NoVersion); } #[test] @@ -1837,7 +1833,7 @@ fn test_install_to_rust_path() { let p_id = PkgId::new("foo"); let second_workspace = create_local_package(&p_id); let second_workspace = second_workspace.path(); - let first_workspace = mk_empty_workspace(&Path::from_str("p"), &NoVersion, "dest"); + let first_workspace = mk_empty_workspace(&Path::new("p"), &NoVersion, "dest"); let first_workspace = first_workspace.path(); // FIXME (#9639): This needs to handle non-utf8 paths let rust_path = Some(~[(~"RUST_PATH", @@ -1869,7 +1865,7 @@ fn test_target_specific_build_dir() { workspace); assert!(os::path_is_dir(&target_build_dir(workspace))); assert!(built_executable_exists(workspace, "foo")); - assert!(os::list_dir(&workspace.join_str("build")).len() == 1); + assert!(os::list_dir(&workspace.join("build")).len() == 1); } #[test] @@ -1883,10 +1879,10 @@ fn test_target_specific_install_dir() { ~"install", ~"foo"], workspace); - assert!(os::path_is_dir(&workspace.join_many_str(["lib", host_triple()]))); - assert_lib_exists(workspace, &Path::from_str("foo"), NoVersion); - assert!(os::list_dir(&workspace.join_str("lib")).len() == 1); - assert!(os::path_is_dir(&workspace.join_str("bin"))); + assert!(os::path_is_dir(&workspace.join_many(["lib", host_triple()]))); + assert_lib_exists(workspace, &Path::new("foo"), NoVersion); + assert!(os::list_dir(&workspace.join("lib")).len() == 1); + assert!(os::path_is_dir(&workspace.join("bin"))); assert_executable_exists(workspace, "foo"); } @@ -1896,10 +1892,10 @@ fn test_dependencies_terminate() { let b_id = PkgId::new("b"); let workspace = create_local_package(&b_id); let workspace = workspace.path(); - let b_dir = workspace.join_many_str(["src", "b-0.1"]); - let b_subdir = b_dir.join_str("test"); + let b_dir = workspace.join_many(["src", "b-0.1"]); + let b_subdir = b_dir.join("test"); assert!(os::mkdir_recursive(&b_subdir, U_RWX)); - writeFile(&b_subdir.join_str("test.rs"), + writeFile(&b_subdir.join("test.rs"), "extern mod b; use b::f; #[test] fn g() { f() }"); command_line_test([~"install", ~"b"], workspace); } @@ -1960,13 +1956,13 @@ fn correct_package_name_with_rust_path_hack() { let bar_id = PkgId::new("bar"); let foo_workspace = create_local_package(&foo_id); let foo_workspace = foo_workspace.path(); - let dest_workspace = mk_empty_workspace(&Path::from_str("bar"), &NoVersion, "dest_workspace"); + let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace"); let dest_workspace = dest_workspace.path(); - writeFile(&dest_workspace.join_many_str(["src", "bar-0.1", "main.rs"]), + writeFile(&dest_workspace.join_many(["src", "bar-0.1", "main.rs"]), "extern mod blat; fn main() { let _x = (); }"); - let foo_path = foo_workspace.join_many_str(["src", "foo-0.1"]); + let foo_path = foo_workspace.join_many(["src", "foo-0.1"]); // FIXME (#9639): This needs to handle non-utf8 paths let rust_path = Some(~[(~"RUST_PATH", format!("{}:{}", dest_workspace.as_str().unwrap(), foo_path.as_str().unwrap()))]); @@ -1989,7 +1985,7 @@ fn test_rustpkg_test_creates_exec() { let foo_id = PkgId::new("foo"); let foo_workspace = create_local_package(&foo_id); let foo_workspace = foo_workspace.path(); - writeFile(&foo_workspace.join_many_str(["src", "foo-0.1", "test.rs"]), + writeFile(&foo_workspace.join_many(["src", "foo-0.1", "test.rs"]), "#[test] fn f() { assert!('a' == 'a'); }"); command_line_test([~"test", ~"foo"], foo_workspace); assert!(test_executable_exists(foo_workspace, "foo")); @@ -2013,7 +2009,7 @@ fn test_rebuild_when_needed() { let foo_id = PkgId::new("foo"); let foo_workspace = create_local_package(&foo_id); let foo_workspace = foo_workspace.path(); - let test_crate = foo_workspace.join_many_str(["src", "foo-0.1", "test.rs"]); + let test_crate = foo_workspace.join_many(["src", "foo-0.1", "test.rs"]); writeFile(&test_crate, "#[test] fn f() { assert!('a' == 'a'); }"); command_line_test([~"test", ~"foo"], foo_workspace); assert!(test_executable_exists(foo_workspace, "foo")); @@ -2033,7 +2029,7 @@ fn test_no_rebuilding() { let foo_id = PkgId::new("foo"); let foo_workspace = create_local_package(&foo_id); let foo_workspace = foo_workspace.path(); - let test_crate = foo_workspace.join_many_str(["src", "foo-0.1", "test.rs"]); + let test_crate = foo_workspace.join_many(["src", "foo-0.1", "test.rs"]); writeFile(&test_crate, "#[test] fn f() { assert!('a' == 'a'); }"); command_line_test([~"test", ~"foo"], foo_workspace); assert!(test_executable_exists(foo_workspace, "foo")); @@ -2058,16 +2054,16 @@ fn test_installed_read_only() { let repo_subdir = repo.join_many_str(["mockgithub.com", "catamorphism", "test-pkg"]); debug2!("repo_subdir = {}", repo_subdir.display()); - writeFile(&repo_subdir.join_str("main.rs"), + writeFile(&repo_subdir.join("main.rs"), "fn main() { let _x = (); }"); - writeFile(&repo_subdir.join_str("lib.rs"), + writeFile(&repo_subdir.join("lib.rs"), "pub fn f() { let _x = (); }"); add_git_tag(&repo_subdir, ~"0.1"); // this has the effect of committing the files // FIXME (#9639): This needs to handle non-utf8 paths command_line_test([~"install", temp_pkg_id.path.as_str().unwrap().to_owned()], repo); - let ws = repo.join_str(".rust"); + let ws = repo.join(".rust"); // Check that all files exist debug2!("Checking for files in {}", ws.display()); let exec = target_executable_in_workspace(&temp_pkg_id, &ws); @@ -2099,9 +2095,9 @@ fn test_installed_local_changes() { debug2!("repo_subdir = {}", repo_subdir.display()); assert!(os::mkdir_recursive(&repo.join_many_str([".rust", "src"]), U_RWX)); - writeFile(&repo_subdir.join_str("main.rs"), + writeFile(&repo_subdir.join("main.rs"), "fn main() { let _x = (); }"); - writeFile(&repo_subdir.join_str("lib.rs"), + writeFile(&repo_subdir.join("lib.rs"), "pub fn f() { let _x = (); }"); add_git_tag(&repo_subdir, ~"0.1"); // this has the effect of committing the files @@ -2127,13 +2123,13 @@ fn test_installed_local_changes() { }; // Make a local change to it - writeFile(&target_dir.join_str("lib.rs"), + writeFile(&target_dir.join("lib.rs"), "pub fn g() { let _x = (); }"); // Finally, make *another* package that uses it let importer_pkg_id = fake_pkg(); let main_subdir = create_local_package_in(&importer_pkg_id, hacking_workspace); - writeFile(&main_subdir.join_str("main.rs"), + writeFile(&main_subdir.join("main.rs"), "extern mod test = \"mockgithub.com/catamorphism/test-pkg\"; \ use test::g; fn main() { g(); }"); diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index 14de18734ed..c5e81e6dc4a 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -467,8 +467,7 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> { self.context.context.use_rust_path_hack, pkg_id); let (outputs_disc, inputs_disc) = - self.context.install(pkg_src, - &JustOne(Path::from_str(lib_crate_filename))); + self.context.install(pkg_src, &JustOne(Path::new(lib_crate_filename))); debug2!("Installed {}, returned {:?} dependencies and \ {:?} transitive dependencies", lib_name, outputs_disc.len(), inputs_disc.len()); @@ -492,12 +491,13 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> { self.exec.discover_input(*what, *dep, digest_file_with_date( - &Path::from_str(*dep))); + &Path::new(dep.as_slice()))); } else if *what == ~"binary" { self.exec.discover_input(*what, *dep, - digest_only_date(&Path::from_str(*dep))); + digest_only_date( + &Path::new(dep.as_slice()))); } else { fail2!("Bad kind: {}", *what); diff --git a/src/librustpkg/version.rs b/src/librustpkg/version.rs index d0c76498c62..21abeeb03e3 100644 --- a/src/librustpkg/version.rs +++ b/src/librustpkg/version.rs @@ -99,7 +99,7 @@ pub fn try_getting_local_version(local_path: &Path) -> Option<Version> { let rustpath = rust_path(); for rp in rustpath.iter() { let local_path = rp.join_path(local_path); - let git_dir = local_path.join_str(".git"); + let git_dir = local_path.join(".git"); if !os::path_is_dir(&git_dir) { continue; } @@ -148,7 +148,7 @@ pub fn try_getting_version(remote_path: &Path) -> Option<Version> { str::from_utf8(outp.output), str::from_utf8(outp.error)); let mut output = None; - let git_dir = tmp_dir.join_str(".git"); + let git_dir = tmp_dir.join(".git"); debug2!("(getting version, now getting tags) executing \\{git --git-dir={} tag -l\\}", git_dir.display()); // FIXME (#9639): This needs to handle non-utf8 paths diff --git a/src/librustpkg/workspace.rs b/src/librustpkg/workspace.rs index 15f9760a637..b4c2a66c1aa 100644 --- a/src/librustpkg/workspace.rs +++ b/src/librustpkg/workspace.rs @@ -52,7 +52,7 @@ pub fn pkg_parent_workspaces(cx: &Context, pkgid: &PkgId) -> ~[Path] { } pub fn is_workspace(p: &Path) -> bool { - os::path_is_dir(&p.join_str("src")) + os::path_is_dir(&p.join("src")) } /// Construct a workspace and package-ID name based on the current directory. @@ -60,7 +60,7 @@ pub fn is_workspace(p: &Path) -> bool { pub fn cwd_to_workspace() -> Option<(Path, PkgId)> { let cwd = os::getcwd(); for path in rust_path().move_iter() { - let srcpath = path.join_str("src"); + let srcpath = path.join("src"); if srcpath.is_ancestor_of(&cwd) { let rel = cwd.path_relative_from(&srcpath); let rel_s = rel.and_then_ref(|p|p.as_str()); |
