Skip to content

Commit c135cb2

Browse files
committed
auto merge of #9235 : olsonjeffery/rust/newrt_file_io_1, r=thestinger
A quick rundown: - added `file::{readdir, stat, mkdir, rmdir}` - Added access-constrained versions of `FileStream`; `FileReader` and `FileWriter` respectively - big rework in `uv::file` .. most actions are by-val-self methods on `FsRequest`; `FileDescriptor` has gone the way of the dinosaurs - playing nice w/ homing IO (I just copied ecr's work, hehe), etc - added `FileInfo` trait, with an impl for `Path` - wrapper for file-specific actions, with the file path always implied by self's value - has the means to create `FileReader` & `FileWriter` (this isn't exposed in the top-level free function API) - has "safe" wrappers for `stat()` that won't throw in the event of non-existence/error (in this case, I mean `is_file` and `exists`) - actions should fail if done on non-regular-files, as appropriate - added `DirectoryInfo` trait, with an impl for `Path` - pretty much ditto above, but for directories - added `readdir` (!!) to iterate over entries in a dir as a `~[Path]` (this was *brutal* to get working) ...<del>and lots of other stuff</del>not really. Do your worst!
2 parents 9e8fb4a + 70152ff commit c135cb2

File tree

10 files changed

+1444
-231
lines changed

10 files changed

+1444
-231
lines changed

src/libstd/os.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,7 @@ pub fn env() -> ~[(~str,~str)] {
196196
if (ch as uint == 0) {
197197
fail!("os::env() failure getting env string from OS: %s", os::last_os_error());
198198
}
199-
let mut curr_ptr: uint = ch as uint;
200-
let mut result = ~[];
201-
while(*(curr_ptr as *libc::c_char) != 0 as libc::c_char) {
202-
let env_pair = str::raw::from_c_str(
203-
curr_ptr as *libc::c_char);
204-
result.push(env_pair);
205-
curr_ptr +=
206-
libc::strlen(curr_ptr as *libc::c_char) as uint
207-
+ 1;
208-
}
199+
let result = str::raw::from_c_multistring(ch as *libc::c_char, None);
209200
FreeEnvironmentStringsA(ch);
210201
result
211202
}

0 commit comments

Comments
 (0)