Convert std::generic_os to istrs. Issue #855
This commit is contained in:
parent
ccc68fc18b
commit
85b4253bc1
6 changed files with 41 additions and 25 deletions
|
|
@ -5,6 +5,7 @@
|
|||
* interface.
|
||||
*/
|
||||
import std::vec;
|
||||
import std::istr;
|
||||
import std::option;
|
||||
import std::generic_os;
|
||||
import base::*;
|
||||
|
|
@ -26,9 +27,11 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
|
|||
// option::t<str> rather than just an maybe-empty string.
|
||||
|
||||
let var = expr_to_str(cx, args[0], "#env requires a string");
|
||||
alt generic_os::getenv(var) {
|
||||
alt generic_os::getenv(istr::from_estr(var)) {
|
||||
option::none. { ret make_new_str(cx, sp, ""); }
|
||||
option::some(s) { ret make_new_str(cx, sp, s); }
|
||||
option::some(s) {
|
||||
ret make_new_str(cx, sp, istr::to_estr(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue