Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 9299748

Browse files
author
Richard Hua
committed
Refactoring - remove deleteDirectory() function
1 parent b20d56f commit 9299748

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,11 @@ public static void copyDirectoryContents(String sourceDirectoryPath, String dest
5454
}
5555
}
5656

57-
public static void deleteDirectory(File directory) {
58-
if (directory.exists()) {
59-
File[] files = directory.listFiles();
60-
if (files != null) {
61-
for (File file : files) {
62-
if(file.isDirectory()) {
63-
deleteDirectory(file);
64-
}
65-
else {
66-
file.delete();
67-
}
68-
}
69-
}
70-
}
71-
directory.delete();
72-
}
73-
7457
public static void deleteDirectoryAtPath(String directoryPath) {
75-
deleteDirectory(new File(directoryPath));
58+
File file = new File(directoryPath);
59+
if (file.exists()) {
60+
deleteFileOrFolderSilently(file);
61+
}
7662
}
7763

7864
public static void deleteFileAtPathSilently(String path) {
@@ -145,7 +131,7 @@ public static void unzipFile(File zipFile, String destination) throws IOExceptio
145131

146132
File destinationFolder = new File(destination);
147133
if (destinationFolder.exists()) {
148-
deleteDirectory(destinationFolder);
134+
deleteFileOrFolderSilently(destinationFolder);
149135
}
150136

151137
destinationFolder.mkdirs();

0 commit comments

Comments
 (0)