about summary refs log tree commit diff
path: root/src/libstd/old_io
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-02-25 10:29:39 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-02-25 10:29:39 +0530
commitb18584cbd942e2559e718d6318fdbc494e9047bd (patch)
tree3be7b8533626450b30f233f725a716546159090d /src/libstd/old_io
parent7b7cf84975fa9da0a301028b28be8b255f2fcd6f (diff)
parent2d200c9c8bd6659720a68ab8dd74218b1e58c1e9 (diff)
downloadrust-b18584cbd942e2559e718d6318fdbc494e9047bd.tar.gz
rust-b18584cbd942e2559e718d6318fdbc494e9047bd.zip
Rollup merge of #22727 - alexcrichton:prep-env, r=aturon
 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]
Diffstat (limited to 'src/libstd/old_io')
-rw-r--r--src/libstd/old_io/tempfile.rs6
-rw-r--r--src/libstd/old_io/test.rs5
2 files changed, 7 insertions, 4 deletions
diff --git a/src/libstd/old_io/tempfile.rs b/src/libstd/old_io/tempfile.rs
index 42317c7a2d4..76753dca52e 100644
--- a/src/libstd/old_io/tempfile.rs
+++ b/src/libstd/old_io/tempfile.rs
@@ -96,9 +96,10 @@ impl TempDir {
     /// deleted once the returned wrapper is destroyed.
     ///
     /// If no directory can be created, `Err` is returned.
+    #[allow(deprecated)]
     pub fn new_in(tmpdir: &Path, prefix: &str) -> IoResult<TempDir> {
         if !tmpdir.is_absolute() {
-            let cur_dir = try!(env::current_dir());
+            let cur_dir = try!(::os::getcwd());
             return TempDir::new_in(&cur_dir.join(tmpdir), prefix);
         }
 
@@ -132,8 +133,9 @@ impl TempDir {
     /// deleted once the returned wrapper is destroyed.
     ///
     /// If no directory can be created, `Err` is returned.
+    #[allow(deprecated)]
     pub fn new(prefix: &str) -> IoResult<TempDir> {
-        TempDir::new_in(&env::temp_dir(), prefix)
+        TempDir::new_in(&::os::tmpdir(), prefix)
     }
 
     /// Unwrap the wrapped `std::path::Path` from the `TempDir` wrapper.
diff --git a/src/libstd/old_io/test.rs b/src/libstd/old_io/test.rs
index ee72beccfa8..43c0b9268a2 100644
--- a/src/libstd/old_io/test.rs
+++ b/src/libstd/old_io/test.rs
@@ -38,10 +38,11 @@ fn next_test_unix_socket() -> String {
 
 /// Get a temporary path which could be the location of a unix socket
 #[cfg(not(target_os = "ios"))]
+#[allow(deprecated)]
 pub fn next_test_unix() -> Path {
     let string = next_test_unix_socket();
     if cfg!(unix) {
-        env::temp_dir().join(string)
+        ::os::tmpdir().join(string)
     } else {
         Path::new(format!("{}{}", r"\\.\pipe\", string))
     }
@@ -88,7 +89,7 @@ fn base_port() -> u16 {
 
     // FIXME (#9639): This needs to handle non-utf8 paths
     let path = env::current_dir().unwrap();
-    let path_s = path.as_str().unwrap();
+    let path_s = path.to_str().unwrap();
 
     let mut final_base = base;