Skip to content

Commit f093c07

Browse files
committed
fix: delete symbol link
1 parent 3396c36 commit f093c07

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

app/src/main/java/io/neoterm/setup/SetupThread.java

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.io.BufferedReader;
99
import java.io.File;
1010
import java.io.FileOutputStream;
11+
import java.io.IOException;
1112
import java.io.InputStreamReader;
1213
import java.util.ArrayList;
1314
import java.util.List;
@@ -123,47 +124,42 @@ public void run() {
123124
throw new RuntimeException("Unable to rename staging folder");
124125
}
125126

126-
activity.runOnUiThread(new Runnable() {
127-
@Override
128-
public void run() {
129-
resultListener.onResult(null);
130-
}
131-
});
127+
activity.runOnUiThread(() -> resultListener.onResult(null));
132128
} catch (final Exception e) {
133129
NLog.INSTANCE.e(EmulatorDebug.LOG_TAG, "Bootstrap error", e);
134-
activity.runOnUiThread(new Runnable() {
135-
@Override
136-
public void run() {
137-
try {
138-
resultListener.onResult(e);
139-
} catch (RuntimeException e) {
140-
// Activity already dismissed - ignore.
141-
}
130+
activity.runOnUiThread(() -> {
131+
try {
132+
resultListener.onResult(e);
133+
} catch (RuntimeException e1) {
134+
// Activity already dismissed - ignore.
142135
}
143136
});
144137
} finally {
145-
activity.runOnUiThread(new Runnable() {
146-
@Override
147-
public void run() {
148-
try {
149-
progressDialog.dismiss();
150-
} catch (RuntimeException e) {
151-
// Activity already dismissed - ignore.
152-
}
138+
activity.runOnUiThread(() -> {
139+
try {
140+
progressDialog.dismiss();
141+
} catch (RuntimeException e) {
142+
// Activity already dismissed - ignore.
153143
}
154144
});
155145
}
156146
}
157147

158-
private static void deleteFolder(File fileOrDirectory) {
159-
File[] children = fileOrDirectory.listFiles();
160-
if (children != null) {
161-
for (File child : children) {
162-
deleteFolder(child);
148+
private static void deleteFolder(File fileOrDirectory) throws IOException {
149+
if (fileOrDirectory.getCanonicalPath().equals(fileOrDirectory.getAbsolutePath()) && fileOrDirectory.isDirectory()) {
150+
File[] children = fileOrDirectory.listFiles();
151+
152+
if (children != null) {
153+
for (File child : children) {
154+
deleteFolder(child);
155+
}
163156
}
164157
}
158+
165159
if (!fileOrDirectory.delete()) {
166-
throw new RuntimeException("Unable to delete " + (fileOrDirectory.isDirectory() ? "directory " : "file ") + fileOrDirectory.getAbsolutePath());
160+
throw new RuntimeException("Unable to delete "
161+
+ (fileOrDirectory.isDirectory() ? "directory " : "file ")
162+
+ fileOrDirectory.getAbsolutePath());
167163
}
168164
}
169165
}

0 commit comments

Comments
 (0)