+FS::Path InstalledFile::generate_target_path(const FS::Path &prefix, const FileTarget &tgt, const string &loc)
+{
+ if(!tgt.is_installable() && loc.empty())
+ throw invalid_argument(tgt.get_name()+" is not installable");
+
+ FS::Path mid;
+ if(!loc.empty())
+ mid = loc;
+ else if(const Component *comp = tgt.get_component())
+ mid = comp->get_install_map().get_install_location(tgt);
+ else
+ mid = tgt.get_install_location();
+
+ string fn = FS::basename(tgt.get_path());
+ if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&tgt))
+ if(!shlib->get_soname().empty())
+ fn = shlib->get_soname();
+
+ return prefix/mid/fn;
+}
+