X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finstallmap.cpp;h=448f997b2e0822381707238e556be304a7c808d2;hb=799d256e952913524c5e51a59c836e7a4cb52ea5;hp=8f1995bc905c3a4a6d38dfea113958570191712e;hpb=6140518acb736f9020005245686bfbc5fca2d329;p=builder.git diff --git a/source/installmap.cpp b/source/installmap.cpp index 8f1995b..448f997 100644 --- a/source/installmap.cpp +++ b/source/installmap.cpp @@ -1,3 +1,4 @@ +#include #include #include "component.h" #include "filetarget.h" @@ -23,11 +24,9 @@ FS::Path InstallMap::get_install_location(const FileTarget &target) const if(comp && !comp->get_overlays().empty()) { // Check if the target resides in an overlay directory - const Component::OverlayList &overlays = comp->get_overlays(); string last_dir = FS::basename(FS::dirname(target.get_path())); - for(Component::OverlayList::const_iterator i=overlays.begin(); i!=overlays.end(); ++i) - if(last_dir==*i) - overlay_depth = 1; + if(any_equals(comp->get_overlays(), last_dir)) + overlay_depth = 1; } FS::Path source = target.get_path(); @@ -40,9 +39,8 @@ FS::Path InstallMap::get_install_location(const FileTarget &target) const if(temp_depth>0) { // If it is, use the generating template's directory instead - const Target::Dependencies &deps = target.get_dependencies(); - for(Target::Dependencies::const_iterator i=deps.begin(); i!=deps.end(); ++i) - if(const TemplateFile *tmpl = dynamic_cast(*i)) + for(Target *d: target.get_dependencies()) + if(const TemplateFile *tmpl = dynamic_cast(d)) { source = FS::dirname(tmpl->get_path())/FS::basename(source); break; @@ -53,15 +51,15 @@ FS::Path InstallMap::get_install_location(const FileTarget &target) const /* Look for a mapping entry matching both the target's original location and default install location */ FS::Path install = target.get_install_location(); - for(list::const_iterator i=entries.begin(); i!=entries.end(); ++i) + for(const Entry &e: entries) { - int source_depth = FS::descendant_depth(source, i->source); + int source_depth = FS::descendant_depth(source, e.source); if(source_depth>=0) { - FS::Path install_base = FS::common_ancestor(install, i->install); + FS::Path install_base = FS::common_ancestor(install, e.install); if(install_base.size()>1) { - install = i->install/source.subpath(i->source.size(), source_depth-1-overlay_depth); + install = e.install/source.subpath(e.source.size(), source_depth-1-overlay_depth); break; } }