]> Dogcows Code - chaz/yoink/blobdiff - src/moof/resource.cc
configuration cleanup and bugfixes
[chaz/yoink] / src / moof / resource.cc
index d22ae217a28d81269460fa8fda3201764bccc37d..359d1b4dcdfc35fcb3b2bb8d8a3394ecbee60925 100644 (file)
@@ -9,18 +9,17 @@
 *
 **************************************************************************/
 
-#include "../config.h"
-
-#include <queue>
+#include "config.h"
 
 #ifdef USE_HOTLOADING
 #include <sys/inotify.h>
 #include <sys/ioctl.h>
 #endif
 
+#include <queue>
+
 #include <boost/algorithm/string.hpp>
 #include <boost/weak_ptr.hpp>
-
 #include <stlplus/portability/file_system.hpp>
 
 #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<std::string,resource_weakptr,hash_function>::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_, ":");
This page took 0.01867 seconds and 4 git commands to generate.