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

View File

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