+ if (file.isFile()){
+ if (!file.delete()) throw new IOException("Failed to delete file: " + file);
+ } else {
+ if (isSymbolicLink(file.toPath()) && !file.delete())
+ throw new IOException("Failed to delete symlink: " + file);
+ }
+ }
+
+ private static void deleteDirectory(File file) throws IOException {
+ // if file is symlink that points to directory, no not touch content
+ if (!isSymbolicLink(file.toPath())){