X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2FCache.java;fp=src%2Fbe%2Fnikiroo%2Futils%2FCache.java;h=6233082742606f72538fb5ccb2a3ffd4c64e9136;hb=47c88873d2d13652786751464abbeace5899ec1c;hp=779b194f5cc66f0e706865e360c6a7b992344f9d;hpb=a624b2511a147ed8e4de121a6f831057b9cfb7e4;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/Cache.java b/src/be/nikiroo/utils/Cache.java index 779b194..6233082 100644 --- a/src/be/nikiroo/utils/Cache.java +++ b/src/be/nikiroo/utils/Cache.java @@ -326,9 +326,12 @@ public class Cache { * in case of I/O error */ private long save(InputStream in, File cached) throws IOException { - // We delete AFTER so not to remove the subdir we will use... - long bytes = IOUtils.write(in, cached); + // We want to force at least an immediate SAVE/LOAD to work for some + // workflows, even if we don't accept cached files (times set to "0" + // -- and not "-1" or a positive value) clean(true, dir, 10); + cached.getParentFile().mkdirs(); // in case we deleted our own parent + long bytes = IOUtils.write(in, cached); return bytes; }