X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fresource.cc;h=359d1b4dcdfc35fcb3b2bb8d8a3394ecbee60925;hp=d22ae217a28d81269460fa8fda3201764bccc37d;hb=51069fee9139ab8d14ecc80dffbe5deecb73d9e0;hpb=bc795376d093ee097040f029b891b5435eb3bd21 diff --git a/src/moof/resource.cc b/src/moof/resource.cc index d22ae21..359d1b4 100644 --- a/src/moof/resource.cc +++ b/src/moof/resource.cc @@ -9,18 +9,17 @@ * **************************************************************************/ -#include "../config.h" - -#include +#include "config.h" #ifdef USE_HOTLOADING #include #include #endif +#include + #include #include - #include #include "hash.hh" @@ -108,7 +107,11 @@ resource_ptr resource::load(const std::string& path) { std::string extension = stlplus::extension_part(path); - if (!find(path)) return resource_ptr(); + if (!find(path)) + { + log_error("trying to load missing resource:", path); + return resource_ptr(); + } hash::iterator it; it = resource_table_.find(path); @@ -128,8 +131,7 @@ resource_ptr resource::load(const std::string& path) resource_table_[path] = rsrc; #ifdef USE_HOTLOADING - int wd = inotify_add_watch(monitor_fd_, - path.c_str(), IN_MODIFY); + int wd = inotify_add_watch(monitor_fd_, path.c_str(), IN_MODIFY); rsrc->set_watch_descriptor(wd); monitor_lookup_[wd] = path; #endif @@ -172,8 +174,7 @@ void resource::reload() unloader_ = resource->unloader_; #ifdef USE_HOTLOADING - int wd = inotify_add_watch(monitor_fd_, - path_.c_str(), IN_MODIFY); + int wd = inotify_add_watch(monitor_fd_, path_.c_str(), IN_MODIFY); set_watch_descriptor(wd); monitor_lookup_[wd] = path_; #endif @@ -190,9 +191,17 @@ void resource::add_search_paths(const std::string& paths) 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_, ":");