- log_info("looking for", name, "in", search_paths_);
- return stlplus::lookup(name, search_paths_, ":");
+ std::vector<std::string> paths;
+ boost::split(paths, search_paths_, boost::is_any_of(":"));
+
+ std::string ext = stlplus::extension_part(name);
+ std::string prefix("hi");
+
+ loader_ptr loader;
+ call_registry(ext, loader, lookup);
+ if (loader) prefix = loader->prefix();
+
+ log_info("find_file:", ext, prefix);
+
+ std::vector<std::string>::iterator it;
+ for (it = paths.begin(); it != paths.end(); ++it)
+ {
+ std::string path = stlplus::create_filespec(*it, name);
+ log_info("looking for", name, "at", path);
+ if (stlplus::file_exists(path)) return path;
+
+ // try it with the prefix added
+ if (!prefix.empty())
+ {
+ *it = stlplus::create_filespec(*it, prefix);
+ path = stlplus::create_filespec(*it, name);
+ log_info("looking for", name, "at", path);
+ if (stlplus::file_exists(path)) return path;
+ }
+ }
+
+
+ log_error("cannot find resource file:", name);
+ return std::string();