fix: delete symbol link
This commit is contained in:
@ -8,6 +8,7 @@ import android.util.Pair;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -123,47 +124,42 @@ final class SetupThread extends Thread {
|
|||||||
throw new RuntimeException("Unable to rename staging folder");
|
throw new RuntimeException("Unable to rename staging folder");
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(() -> resultListener.onResult(null));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
resultListener.onResult(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
NLog.INSTANCE.e(EmulatorDebug.LOG_TAG, "Bootstrap error", e);
|
NLog.INSTANCE.e(EmulatorDebug.LOG_TAG, "Bootstrap error", e);
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(() -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
try {
|
||||||
resultListener.onResult(e);
|
resultListener.onResult(e);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e1) {
|
||||||
// Activity already dismissed - ignore.
|
// Activity already dismissed - ignore.
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(() -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
try {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// Activity already dismissed - ignore.
|
// Activity already dismissed - ignore.
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void deleteFolder(File fileOrDirectory) {
|
private static void deleteFolder(File fileOrDirectory) throws IOException {
|
||||||
|
if (fileOrDirectory.getCanonicalPath().equals(fileOrDirectory.getAbsolutePath()) && fileOrDirectory.isDirectory()) {
|
||||||
File[] children = fileOrDirectory.listFiles();
|
File[] children = fileOrDirectory.listFiles();
|
||||||
|
|
||||||
if (children != null) {
|
if (children != null) {
|
||||||
for (File child : children) {
|
for (File child : children) {
|
||||||
deleteFolder(child);
|
deleteFolder(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!fileOrDirectory.delete()) {
|
if (!fileOrDirectory.delete()) {
|
||||||
throw new RuntimeException("Unable to delete " + (fileOrDirectory.isDirectory() ? "directory " : "file ") + fileOrDirectory.getAbsolutePath());
|
throw new RuntimeException("Unable to delete "
|
||||||
|
+ (fileOrDirectory.isDirectory() ? "directory " : "file ")
|
||||||
|
+ fileOrDirectory.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user