std: Move std::env to the new I/O APIs

This commit moves `std::env` away from the `std::old_io` error type as well as
the `std::old_path` module. Methods returning an error now return `io::Error`
and methods consuming or returning paths use `std::path` instead of
`std::old_path`. This commit does not yet mark these APIs as `#[stable]`.

This commit also migrates `std::old_io::TempDir` to `std::fs::TempDir` with
essentially the exact same API. This type was added to interoperate with the new
path API and has its own `tempdir` feature.

Finally, this commit reverts the deprecation of `std::os` APIs returning the old
path API types. This deprecation can come back once the entire `std::old_path`
module is deprecated.

[breaking-change]
This commit is contained in:
Alex Crichton
2015-02-23 10:59:17 -08:00
parent f0f7ca27de
commit 2d200c9c8b
31 changed files with 323 additions and 141 deletions

View File

@@ -21,6 +21,7 @@ use ffi::CString;
use mem;
use env;
use str;
use os;
pub struct DynamicLibrary {
handle: *mut u8
@@ -102,7 +103,7 @@ impl DynamicLibrary {
/// process
pub fn search_path() -> Vec<Path> {
match env::var_os(DynamicLibrary::envvar()) {
Some(var) => env::split_paths(&var).collect(),
Some(var) => os::split_paths(var.to_str().unwrap()),
None => Vec::new(),
}
}