- // last ditch effort; maybe it's already a path to a valid resource
- return fopen(path.c_str(), mode.c_str());
+bool resource::find(const std::string& path)
+{
+ std::string file = stlplus::lookup(path, search_paths_, ":");
+ log_info("found file", file, "in", search_paths_);
+ return !stlplus::lookup(path, search_paths_, ":").empty();
+}
+
+std::string resource::find_file(const std::string& name)
+{
+ log_info("looking for", name, "in", search_paths_);
+ return stlplus::lookup(name, search_paths_, ":");
+}
+
+FILE* resource::open_file(const std::string& path, const std::string& mode)
+{
+ std::string file = stlplus::lookup(path, search_paths_, ":");
+ return fopen(file.c_str(), mode.c_str());