+
+FS::Path PackageManager::get_binary_package_file(const string &name)
+{
+ builder.get_logger().log("packagemgr", "Looking for binary package %s", name);
+
+ if(binpkg_files.empty())
+ {
+ for(const FS::Path &p: binpkg_path)
+ {
+ builder.get_logger().log("files", "Traversing %s", p);
+ vector<string> files = list_filtered(p, "\\.bpk$");
+ for(const string &f: files)
+ binpkg_files.push_back(p/f);
+ builder.get_logger().log("packagemgr", "%d binary packages found in %s", files.size(), p);
+ }
+
+ builder.get_logger().log("packagemgr", "%d binary packages found", binpkg_files.size());
+ }
+
+ auto i = find_if(binpkg_files, [&name](const FS::Path &p){ return FS::basepart(FS::basename(p))==name; });
+ if(i!=binpkg_files.end())
+ return *i;
+
+ return FS::Path();
+}
+
+void PackageManager::save_all_caches() const
+{
+ for(const auto &kvp: packages)
+ kvp.second->save_caches();
+}