1 #include <msp/fs/utils.h>
2 #include "filetarget.h"
3 #include "installmap.h"
8 void InstallMap::add_mapping(const FS::Path &src, const FS::Path &inst)
16 FS::Path InstallMap::get_install_location(const FileTarget &target) const
18 const FS::Path &source = target.get_path();
19 FS::Path install = target.get_install_location();
20 for(list<Entry>::const_iterator i=entries.begin(); i!=entries.end(); ++i)
22 int source_depth = FS::descendant_depth(source, i->source);
25 FS::Path install_base = FS::common_ancestor(install, i->install);
26 if(install_base.size()>1)
28 install = i->install/FS::dirname(source).subpath(i->source.size());
38 InstallMap::Loader::Loader(InstallMap &m, const FS::Path &s):
39 DataFile::ObjectLoader<InstallMap>(m),
42 add("map", &Loader::map);
45 void InstallMap::Loader::map(const string &src, const string &inst)
47 obj.add_mapping(source_base/src, inst);