X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finstallmap.cpp;h=8f1995bc905c3a4a6d38dfea113958570191712e;hb=HEAD;hp=22d92b1586751d96943dfe73b675a6d75c112318;hpb=e0c863681c8a5fad5918bb7730ecbc65fbdfbc64;p=builder.git diff --git a/source/installmap.cpp b/source/installmap.cpp deleted file mode 100644 index 22d92b1..0000000 --- a/source/installmap.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include "filetarget.h" -#include "installmap.h" - -using namespace std; -using namespace Msp; - -void InstallMap::add_mapping(const FS::Path &src, const FS::Path &inst) -{ - Entry e; - e.source = src; - e.install = inst; - entries.push_back(e); -} - -FS::Path InstallMap::get_install_location(const FileTarget &target) const -{ - 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) - { - int source_depth = FS::descendant_depth(source, i->source); - if(source_depth>=0) - { - 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()); - break; - } - } - } - - return install; -} - - -InstallMap::Loader::Loader(InstallMap &m, const FS::Path &s): - DataFile::ObjectLoader(m), - source_base(s) -{ - add("map", &Loader::map); -} - -void InstallMap::Loader::map(const string &src, const string &inst) -{ - obj.add_mapping(source_base/src, inst); -}