From: Mikko Rasa Date: Sat, 21 Jul 2012 13:46:29 +0000 (+0300) Subject: Ensure that the directory exists before trying to write the cache X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e13613cecc357b0dd01ef85c7c739fd1e0bfebd2;p=builder.git Ensure that the directory exists before trying to write the cache --- diff --git a/source/cache.cpp b/source/cache.cpp index 087428f..d4a4ebc 100644 --- a/source/cache.cpp +++ b/source/cache.cpp @@ -1,5 +1,7 @@ #include +#include #include +#include #include #include #include @@ -133,6 +135,9 @@ void Cache::save() const if(data.empty() || !changed) return; + FS::Path dir = FS::dirname(filename); + if(!FS::exists(dir)) + FS::mkpath(dir, 0755); package.get_builder().get_logger().log("files", format("Writing %s", filename)); IO::BufferedFile out(filename.str(), IO::M_WRITE);