Workaround for Issue #317

This commit is contained in:
Markus Kreusch
2016-08-10 13:53:04 +02:00
parent 429b26f3d8
commit e8db836eff

View File

@@ -2,6 +2,7 @@ package org.cryptomator.filesystem.nio;
import java.io.IOException;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.file.AccessDeniedException;
import java.nio.file.CopyOption;
import java.nio.file.FileSystems;
import java.nio.file.Files;
@@ -53,7 +54,17 @@ class DefaultNioAccess implements NioAccess {
@Override
public void delete(Path path) throws IOException {
Files.delete(path);
try {
Files.delete(path);
} catch (AccessDeniedException e) {
// workaround for https://github.com/cryptomator/cryptomator/issues/317
try {
if (path.toFile().delete()) return;
} catch (UnsupportedOperationException e2) {
// ignore
}
throw e;
}
}
@Override