X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finstallmap.cpp;h=942b932b98c29babf1fd0d59eb090d53cb1cda30;hb=cb286fd20b9b194947b6b583bf18f8d7e57ae995;hp=22d92b1586751d96943dfe73b675a6d75c112318;hpb=e0c863681c8a5fad5918bb7730ecbc65fbdfbc64;p=builder.git diff --git a/source/installmap.cpp b/source/installmap.cpp index 22d92b1..942b932 100644 --- a/source/installmap.cpp +++ b/source/installmap.cpp @@ -1,4 +1,5 @@ #include +#include "component.h" #include "filetarget.h" #include "installmap.h" @@ -15,6 +16,17 @@ void InstallMap::add_mapping(const FS::Path &src, const FS::Path &inst) FS::Path InstallMap::get_install_location(const FileTarget &target) const { + const Component *comp = target.get_component(); + unsigned overlay_depth = 0; + if(comp && !comp->get_overlays().empty()) + { + 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; + } + const FS::Path &source = target.get_path(); FS::Path install = target.get_install_location(); for(list::const_iterator i=entries.begin(); i!=entries.end(); ++i) @@ -25,7 +37,7 @@ FS::Path InstallMap::get_install_location(const FileTarget &target) const FS::Path install_base = FS::common_ancestor(install, i->install); if(install_base.size()>1) { - install = i->install/FS::dirname(source).subpath(i->source.size()); + install = i->install/source.subpath(i->source.size(), source_depth-1-overlay_depth); break; } }