about summary refs log tree commit diff
path: root/src/libstd/path
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-15 02:36:27 -0800
committerbors <bors@rust-lang.org>2014-02-15 02:36:27 -0800
commitfba32ea79f1828ef441d91abca3635fad57f323d (patch)
tree1d07a3053f3492b25816a46f912df95bd208bd6e /src/libstd/path
parentc9f13b47febb81ef339a15adf0f6ad7a2265c46d (diff)
parentd22b1646aafd51ffc85fcd24492a6211c2c0dfab (diff)
downloadrust-fba32ea79f1828ef441d91abca3635fad57f323d.tar.gz
rust-fba32ea79f1828ef441d91abca3635fad57f323d.zip
auto merge of #12283 : kballard/rust/env-args-bytes, r=erickt
Change `os::args()` and `os::env()` to use `str::from_utf8_lossy()`.
Add new functions `os::args_as_bytes()` and `os::env_as_bytes()` to retrieve the args/env as byte vectors instead.

The existing methods were left returning strings because I expect that the common use-case is to want string handling.

Fixes #7188.
Diffstat (limited to 'src/libstd/path')
-rw-r--r--src/libstd/path/mod.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs
index ed0ce201750..13496033fd0 100644
--- a/src/libstd/path/mod.rs
+++ b/src/libstd/path/mod.rs
@@ -578,8 +578,7 @@ impl BytesContainer for ~[u8] {
 impl BytesContainer for CString {
     #[inline]
     fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
-        let s = self.as_bytes();
-        s.slice_to(s.len()-1)
+        self.as_bytes_no_nul()
     }
 }