import org.tizen.installmanager.core.SnapshotLog;
import org.tizen.installmanager.lib.Log;
import org.tizen.installmanager.lib.ErrorController.ErrorCode;
-import org.tizen.installmanager.lib.Platform;
import org.tizen.installmanager.pkg.lib.PackageManager;
import org.tizen.installmanager.pkg.model.Snapshot;
import org.tizen.installmanager.pkg.model.SnapshotList;
+import org.tizen.installmanager.ui.InstallManagerWindow;
import org.tizen.installmanager.ui.dialog.MessageBoxDlg.DialogType;
import org.tizen.installmanager.ui.dialog.UnzipImageDialog.UNZIP_RESULT;
+import org.tizen.installmanager.ui.page.ViewController;
import org.tizen.installmanager.util.PathUtil;
private String repository = "";
private ServerType serverType = ServerType.SNAPSHOT;
+ private ViewController viewController;
private SnapshotLogDialog snapshotDialog = null;
private static final String STRING_TITLE = "Advanced Configuration";
super(parentShell);
setShellStyle(SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL);
controller = DistributionController.getInstance();
+ viewController = InstallManagerWindow.getInstallManagerWindow().getViewController();
}
/**
}
if (unzipResult != UNZIP_RESULT.SUCCESS) {
+ viewController.removeImageUnzipDir(); // If fail to extract image file, remove it.
repository = "";
} else {
repository = sdkTempDir;
public void loadSdkExtension() {
sdkExtensionInfo.load();
}
+
+ /**
+ * Remove extracted SDK image file.
+ * @param unzipDir Extracting directory.
+ */
+ public void removeImageUnzipDir() {
+ String unzipDir = Config.INSTALL_MANAGER_TEMP_DIRECTORY;
+ File unzipBinaries = new File(PathUtil.get(unzipDir, "binary"));
+ File packageList = new File(PathUtil.get(unzipDir, PackageManager.getInstance().getPackageListFileName()));
+
+ if (unzipBinaries.exists() && unzipBinaries.isDirectory()) {
+ for (File binary : unzipBinaries.listFiles()) {
+ binary.delete();
+ }
+ if (!unzipBinaries.delete()) {
+ Log.err("Fail to remove SDK image package binaries. => " + unzipBinaries.getAbsolutePath());
+ } else {
+ Log.log("Success to remove SDK image package binaries. => " + unzipBinaries.getAbsolutePath());
+ }
+ }
+
+ if (packageList.exists()) {
+ if (!packageList.delete()) {
+ Log.err("Fail to remove SDK image package list. => " + packageList.getAbsolutePath());
+ } else {
+ Log.err("Success to remove SDK image package list. => " + packageList.getAbsolutePath());
+ }
+ }
+ }
}