summaryrefslogtreecommitdiff
path: root/src/ast
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-18 16:18:31 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-18 16:18:31 +0800
commita786768f2ff4afa2a493d69cda21bde83e88063d (patch)
tree84d92bf73034899d3653c71307e3611f817c69ca /src/ast
parent48e99abaf3e22bb95d322f527f4cf154e9ccef66 (diff)
downloadmrust-a786768f2ff4afa2a493d69cda21bde83e88063d.tar.gz
AST - Search output/ and output/test_deps for extern crates
Diffstat (limited to 'src/ast')
-rw-r--r--src/ast/crate.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ast/crate.cpp b/src/ast/crate.cpp
index 5b15a15d..f99389d0 100644
--- a/src/ast/crate.cpp
+++ b/src/ast/crate.cpp
@@ -99,10 +99,20 @@ void Crate::load_extern_crate(Span sp, const ::std::string& name)
{
DEBUG("Loading crate '" << name << "'");
// TODO: Search a list of load paths for the crate
- ::std::string path = "output/lib"+name+".hir";
+
+ ::std::vector< ::std::string> paths { "output/", "output/test_deps/" };
+ ::std::string path;
+ for(const auto& p : paths){
+ path = p + "lib" + name + ".hir";
+
+ if( ::std::ifstream(path).good() ) {
+ break ;
+ }
+ }
if( !::std::ifstream(path).good() ) {
ERROR(sp, E0000, "Unable to locate crate '" << name << "'");
}
+
auto res = m_extern_crates.insert(::std::make_pair( name, ExternCrate { name, path } ));
auto crate_ext_list = mv$( res.first->second.m_hir->m_ext_crates );