Commit da52e70b authored by Damien Leroux's avatar Damien Leroux
Browse files

Cache files are now WORKDIR/FUNC/HASH and directories are automatically created.

parent 18a5eac2
......@@ -458,8 +458,10 @@ template <typename Ret, typename... Args>
std::string get_path() const
{
std::stringstream ss;
ss << cache_directory() << '/' << m_name;
ensure_directory_exists(ss.str());
/*ss << cache_directory() << '/' << m_name << '_' << m_md5_hash.accum << '_' << typeid(Ret).name();*/
ss << cache_directory() << '/' << m_name << '_' << m_md5_hash.accum;
ss << '/' << m_md5_hash.accum;
return ss.str();
}
......
......@@ -78,6 +78,13 @@ bool check_file(const std::string& path, bool req_directory, bool req_writable,
return true;
}
static inline
bool ensure_directory_exists(const std::string& path)
{
return check_file(path, true, true, false)
|| mkdir(path.c_str(), 0770) != -1;
}
#include "input/input.h"
#include "input/read_map.h"
#include "input/read_mark.h"
......
......@@ -124,6 +124,8 @@ int main(int argc, const char** argv)
msg_handler_t::check(true);
ensure_directory_exists(active_settings->work_directory);
#if 0
MSG_DEBUG("new chromosome " << active_settings->map[0].name);
MSG_DEBUG(active_settings->map[0].haplo_sizes);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment