Hotfix to allow for directory creation during migration
This commit is contained in:
parent
5090443b7a
commit
afbfd29d66
8
src/main/java/mdnet/cache/DiskLruCache.java
vendored
8
src/main/java/mdnet/cache/DiskLruCache.java
vendored
|
@ -966,6 +966,10 @@ public final class DiskLruCache implements Closeable {
|
||||||
// Move files to new caching tree if exists
|
// Move files to new caching tree if exists
|
||||||
Path oldCache = Paths.get(directory + File.separator + key + "." + i);
|
Path oldCache = Paths.get(directory + File.separator + key + "." + i);
|
||||||
Path newCache = Paths.get(directory + subKeyPath + File.separator + key + "." + i);
|
Path newCache = Paths.get(directory + subKeyPath + File.separator + key + "." + i);
|
||||||
|
|
||||||
|
File newCacheDirectory = new File(directory + subKeyPath, key + "." + i + ".tmp");
|
||||||
|
newCacheDirectory.getParentFile().mkdirs();
|
||||||
|
|
||||||
if (Files.exists(oldCache)) {
|
if (Files.exists(oldCache)) {
|
||||||
try {
|
try {
|
||||||
Files.move(oldCache, newCache, StandardCopyOption.ATOMIC_MOVE);
|
Files.move(oldCache, newCache, StandardCopyOption.ATOMIC_MOVE);
|
||||||
|
@ -985,6 +989,10 @@ public final class DiskLruCache implements Closeable {
|
||||||
// Move files to new caching tree if exists
|
// Move files to new caching tree if exists
|
||||||
Path oldCache = Paths.get(directory + File.separator + key + "." + i + ".tmp");
|
Path oldCache = Paths.get(directory + File.separator + key + "." + i + ".tmp");
|
||||||
Path newCache = Paths.get(directory + subKeyPath + File.separator + key + "." + i + ".tmp");
|
Path newCache = Paths.get(directory + subKeyPath + File.separator + key + "." + i + ".tmp");
|
||||||
|
|
||||||
|
File newCacheDirectory = new File(directory + subKeyPath, key + "." + i + ".tmp");
|
||||||
|
newCacheDirectory.getParentFile().mkdirs();
|
||||||
|
|
||||||
if (Files.exists(oldCache)) {
|
if (Files.exists(oldCache)) {
|
||||||
try {
|
try {
|
||||||
Files.move(oldCache, newCache, StandardCopyOption.ATOMIC_MOVE);
|
Files.move(oldCache, newCache, StandardCopyOption.ATOMIC_MOVE);
|
||||||
|
|
Loading…
Reference in a new issue