From c2eafd268b982cd9a494dad783f8e3c68b9b4826 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 24 Aug 2011 16:00:26 -0700 Subject: Convert std::fs to istrs. Issue #855 --- src/comp/syntax/parse/eval.rs | 15 +++++++++------ src/comp/syntax/parse/parser.rs | 4 +++- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/comp/syntax/parse') diff --git a/src/comp/syntax/parse/eval.rs b/src/comp/syntax/parse/eval.rs index af1ba91b37b..18d9a04ebbf 100644 --- a/src/comp/syntax/parse/eval.rs +++ b/src/comp/syntax/parse/eval.rs @@ -1,5 +1,6 @@ import std::str; +import std::istr; import std::option; import std::option::some; import std::option::none; @@ -48,10 +49,12 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, ast::cdir_src_mod(id, file_opt, attrs) { let file_path = id + ".rs"; alt file_opt { some(f) { file_path = f; } none. { } } - let full_path = - if std::fs::path_is_absolute(file_path) { - file_path - } else { prefix + std::fs::path_sep() + file_path }; + let full_path = if std::fs::path_is_absolute( + istr::from_estr(file_path)) { + file_path + } else { + prefix + istr::to_estr(std::fs::path_sep()) + file_path + }; if cx.mode == mode_depend { cx.deps += [full_path]; ret; } let p0 = new_parser_from_file(cx.sess, cx.cfg, full_path, cx.chpos, @@ -73,9 +76,9 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, let path = id; alt dir_opt { some(d) { path = d; } none. { } } let full_path = - if std::fs::path_is_absolute(path) { + if std::fs::path_is_absolute(istr::from_estr(path)) { path - } else { prefix + std::fs::path_sep() + path }; + } else { prefix + istr::to_estr(std::fs::path_sep()) + path }; let m0 = eval_crate_directives_to_mod(cx, cdirs, full_path); let i = @{ident: id, diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 8ee2645fe5d..59cea6e131d 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -2,6 +2,7 @@ import std::io; import std::vec; import std::str; +import std::istr; import std::option; import std::option::some; import std::option::none; @@ -2525,7 +2526,8 @@ fn parse_crate_from_crate_file(input: &str, cfg: &ast::crate_cfg, sess: &parse_sess) -> @ast::crate { let p = new_parser_from_file(sess, cfg, input, 0u, 0u, CRATE_FILE); let lo = p.get_lo_pos(); - let prefix = std::fs::dirname(p.get_filemap().name); + let prefix = istr::to_estr( + std::fs::dirname(istr::from_estr(p.get_filemap().name))); let leading_attrs = parse_inner_attrs_and_next(p); let crate_attrs = leading_attrs.inner; let first_cdir_attr = leading_attrs.next; -- cgit 1.4.1-3-g733a5