]> git.tdb.fi Git - builder.git/blobdiff - source/cache.cpp
Force shared linking on Android
[builder.git] / source / cache.cpp
index 087428fc3cf54cf8341deae68dcb4224b6f3613b..a2d68248d14a91fcb641b9c76c59df5e0772f896 100644 (file)
@@ -1,5 +1,7 @@
 #include <msp/core/maputils.h>
+#include <msp/fs/dir.h>
 #include <msp/fs/stat.h>
+#include <msp/fs/utils.h>
 #include <msp/io/file.h>
 #include <msp/io/print.h>
 #include <msp/strings/utils.h>
@@ -57,7 +59,7 @@ void write_string(IO::Base &out, const string &str)
 
 Cache::Cache(SourcePackage &p):
        package(p),
-       filename(package.get_temp_dir()/"../cache"),
+       filename(package.get_temp_directory()/"../cache"),
        changed(false)
 { }
 
@@ -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);