fix "Update extension"

This commit is contained in:
sirjonasxx 2021-08-29 02:36:53 +02:00
parent 4dedc90344
commit 7ac33ef408
2 changed files with 10 additions and 10 deletions

View File

@ -120,7 +120,7 @@ public class StoreExtensionDetailsOverview extends HOverview {
@Override
public void buttonClick(GExtensionStore gExtensionStore) {
int mode = mode();
if (mode == 2) return;
if (mode == 1) return;
String modeString = mode() == 0 ? "Install" : "Update";
HOverview selff = this;
@ -149,7 +149,7 @@ public class StoreExtensionDetailsOverview extends HOverview {
if (mode() == 0) {
StoreExtensionTools.installExtension(extension.getTitle(), storeRepository, listener);
}
else if (mode() == 1) {
else if (mode() == 2) {
StoreExtensionTools.updateExtension(extension.getTitle(), storeRepository, listener);
}
}

View File

@ -142,10 +142,14 @@ public class StoreExtensionTools {
} catch (MalformedURLException e) {
listener.fail("Invalid extension URL");
removeExtension(path); // cleanup
try {
removeExtension(path); // cleanup
} catch (IOException ignore) { }
} catch (IOException e) {
listener.fail("Extension not available in repository");
removeExtension(path); // cleanup
try {
removeExtension(path); // cleanup
} catch (IOException ignore) { }
}
}
else {
@ -161,12 +165,8 @@ public class StoreExtensionTools {
}
public static void removeExtension(String extensionPath) {
try {
FileUtils.deleteDirectory(new File(extensionPath));
} catch (IOException e) {
e.printStackTrace();
}
public static void removeExtension(String extensionPath) throws IOException {
FileUtils.deleteDirectory(new File(extensionPath));
}
public static List<InstalledExtension> getInstalledExtension() {