Removed unnecessary checks

This commit is contained in:
JaniruTEC
2023-07-10 16:01:39 +02:00
parent 92b77baf40
commit 328f2f89a8

View File

@@ -73,12 +73,9 @@ public final class MountWithinParentUtil {
private static void removeResidualHideaway(Path hideaway) throws IOException {
if (!Files.isDirectory(hideaway, LinkOption.NOFOLLOW_LINKS)) {
if (SystemUtils.IS_OS_WINDOWS) {
Files.setAttribute(hideaway, WIN_HIDDEN_ATTR, false);
}
throw new MountPointPreparationException(new NotDirectoryException(hideaway.toString()));
}
Files.delete(hideaway);
Files.delete(hideaway); //Fails if not empty
}
static void cleanup(Path mountPoint) {
@@ -89,13 +86,6 @@ public final class MountWithinParentUtil {
LOG.error("Unable to restore hidden directory to mountpoint \"{}\": Directory does not exist. (Deleted by user?)", mountPoint);
return;
}
if (!Files.isDirectory(hideaway, LinkOption.NOFOLLOW_LINKS)) {
LOG.error("Unable to restore hidden directory to mountpoint \"{}\": Not a directory.", mountPoint);
if (SystemUtils.IS_OS_WINDOWS) {
Files.setAttribute(hideaway, WIN_HIDDEN_ATTR, false);
}
return;
}
Files.move(hideaway, mountPoint);
if (SystemUtils.IS_OS_WINDOWS) {