diff options
author | Marius Kintel <marius@kintel.net> | 2013-05-27 01:55:00 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-05-27 01:55:00 (GMT) |
commit | 0967a26bff45951d7b86fe628e8b1156e6e40ede (patch) | |
tree | fa72ca81652700a373023dace3a4163036ece20e /src/module.cc | |
parent | 837b574351cdaddaebed6c4b0ba281b7e20c2a0f (diff) |
Support locating previously missing modules. yet another part of #364
Diffstat (limited to 'src/module.cc')
-rw-r--r-- | src/module.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/module.cc b/src/module.cc index e910c44..425403b 100644 --- a/src/module.cc +++ b/src/module.cc @@ -218,20 +218,32 @@ bool FileModule::handleDependencies() bool changed = false; // Iterating manually since we want to modify the container while iterating + + + // If a lib in usedlibs was previously missing, we need to relocate it + // by searching the applicable paths. We can identify a previously missing module + // as it will have a relative path. FileModule::ModuleContainer::iterator iter = this->usedlibs.begin(); while (iter != this->usedlibs.end()) { FileModule::ModuleContainer::iterator curr = iter++; FileModule *oldmodule = curr->second; - curr->second = ModuleCache::instance()->evaluate(curr->first); + + // Get an absolute filename for the module + std::string filename = curr->first; + if (!boosty::is_absolute(filename)) { + fs::path fullpath = find_valid_path(this->path, filename); + if (!fullpath.empty()) filename = boosty::stringy(fullpath); + } + + curr->second = ModuleCache::instance()->evaluate(filename); if (curr->second != oldmodule) { changed = true; #ifdef DEBUG - PRINTB_NOCACHE(" %s: %p", curr->first % curr->second); + PRINTB_NOCACHE(" %s: %p", filename % curr->second); #endif } if (!curr->second) { - PRINTB_NOCACHE("WARNING: Failed to compile library '%s'.", curr->first); - this->usedlibs.erase(curr); + PRINTB_NOCACHE("WARNING: Failed to compile library '%s'.", filename); } } |