这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/src/main/java/com/termux/app/TermuxInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
Expand Down Expand Up @@ -209,11 +210,15 @@ private static String determineTermuxArchName() {
}

/** Delete a folder and all its content or throw. */
static void deleteFolder(File fileOrDirectory) {
static void deleteFolder(File fileOrDirectory) throws IOException {
File[] children = fileOrDirectory.listFiles();
if (children != null) {
for (File child : children) {
deleteFolder(child);
if (child.getCanonicalFile().equals(child.getAbsoluteFile())) {
deleteFolder(child);
} else {
child.delete();
}
}
}
if (!fileOrDirectory.delete()) {
Expand All @@ -231,7 +236,7 @@ public void run() {
if (storageDir.exists()) {
try {
deleteFolder(storageDir);
} catch (Exception e) {
} catch (IOException e) {
Log.e(LOG_TAG, "Could not delete old $HOME/storage, " + e.getMessage());
return;
}
Expand Down