if (bResult) {
File configDirFile = new File(
PathUtil.getFromInstalledPath(Config.INFO_DIRECTORY));
- configDirFile.mkdir();
+ if (!configDirFile.mkdir()) {
+ Log.err("Fail to create file ==> " + configDirFile);
+ }
} else {
return false;
}
// temp file cleanup
if (tmp.exists()) {
- tmp.delete();
+ if (!tmp.delete()) {
+ Log.err("Fail to delete file ==> " + tmp);
+ }
}
}
}
return found;
}
});
-
- for (File f : tmpFiles) {
- f.delete();
+
+ if (tmpFiles != null) {
+ for (File f : tmpFiles) {
+ if (!f.delete()) {
+ Log.err("Fail to delete file ==> " + f);
+ }
+ }
}
}
File currentInfoDir = new File(
PathUtil.getFromInstalledPath(Config.INFO_DIRECTORY));
if (!currentInfoDir.exists()) {
- currentInfoDir.mkdirs();
+ if (!currentInfoDir.mkdirs()) {
+ Log.err("Fail to delete file ==> " + currentInfoDir);
+ }
}
File oldInstalledList = new File(PathUtil.get(
return;
}
- File[] oldPackageDir = new File(Config.OLD_INFO_REMOVESCRIPT_PATH)
- .listFiles();
- for (File childFile : oldPackageDir) {
- File currentPackageDir = new File(PathUtil.get(
- PathUtil.getFromInstalledPath(Config.INFO_DIRECTORY),
- childFile.getName()));
+ File[] oldPackageDir = new File(Config.OLD_INFO_REMOVESCRIPT_PATH).listFiles();
+
+ if (oldPackageDir != null) {
+ for (File childFile : oldPackageDir) {
+ File currentPackageDir = new File(PathUtil.get(
+ PathUtil.getFromInstalledPath(Config.INFO_DIRECTORY),
+ childFile.getName()));
+
+ File parentDir = currentPackageDir.getParentFile();
+ if (!parentDir.exists()) {
+ if (!parentDir.mkdirs()) {
+ Log.err("Fail to create file ==> " + parentDir);
+ }
+ }
- File parentDir = currentPackageDir.getParentFile();
- if (!parentDir.exists()) {
- parentDir.mkdirs();
+ PathUtil.move(childFile, currentPackageDir);
}
-
- PathUtil.move(childFile, currentPackageDir);
}
- File[] oldInstalledFileList = new File(
- Config.OLD_INSTALLED_FILE_LIST_DIRECTORY_PATH).listFiles();
- for (File childFile : oldInstalledFileList) {
- File currentInstalledFile = new File(PathUtil.get(PathUtil
- .getFromInstalledPath(Config.INFO_DIRECTORY), PathUtil
- .getFileNameWithOutExtension(childFile.getAbsolutePath()),
- childFile.getName()));
-
- File parentDir = currentInstalledFile.getParentFile();
- if (!parentDir.exists()) {
- parentDir.mkdirs();
- }
+ File[] oldInstalledFileList = new File(Config.OLD_INSTALLED_FILE_LIST_DIRECTORY_PATH).listFiles();
+
+ if (oldInstalledFileList != null) {
+ for (File childFile : oldInstalledFileList) {
+ File currentInstalledFile = new File(PathUtil.get(PathUtil
+ .getFromInstalledPath(Config.INFO_DIRECTORY), PathUtil
+ .getFileNameWithOutExtension(childFile.getAbsolutePath()),
+ childFile.getName()));
+
+ File parentDir = currentInstalledFile.getParentFile();
+ if (!parentDir.exists()) {
+ if (!parentDir.mkdirs()) {
+ Log.err("Fail to create file ==> " + parentDir);
+ }
+ }
- PathUtil.move(childFile, currentInstalledFile);
+ PathUtil.move(childFile, currentInstalledFile);
+ }
}
PathUtil.remove(oldInfoDir);
}
if (Options.doPackageValidation) {
- return checkFileChecksum(pkg, Checksum.getSHA256(filePath));
+ if (Checksum.getSHA256(filePath) != null) {
+ return checkFileChecksum(pkg, Checksum.getSHA256(filePath));
+ } else {
+ return false;
+ }
} else {
return true;
}
// Make target directory
File targetDirFile = new File(targetDir);
if (!targetDirFile.exists()) {
- targetDirFile.mkdirs();
+ if (!targetDirFile.mkdirs()) {
+ Log.err("Fail to create file ==> " + targetDirFile);
+ }
}
// Keep target path in system
File targetDir = new File(Registry.getInstalledPath() + File.separator
+ Config.INSTALL_MANAGER_DIRECTORY);
if (!targetDir.exists()) {
- targetDir.mkdirs();
+ if (!targetDir.mkdirs()) {
+ Log.err("Fail to create directory ==> " + targetDir);
+ }
}
String to = targetDir.getAbsolutePath();
File toFile = getInstalledAppPath();
if (!toFile.exists()) {
- toFile.mkdirs();
+ if (!toFile.mkdirs()) {
+ Log.err("Fail to create file ==> " + toFile);
+ }
}
if (fromFile.getAbsolutePath().equals(toFile.getAbsolutePath())) {
long usableSpace = file.getUsableSpace();
- if (usableSpace == 0) {
+ if (usableSpace == 0 && root != null) {
usableSpace = root.getUsableSpace();
}
return false;
} else {
if (removeScriptTo.exists()) {
- removeScriptTo.delete();
+ if (!removeScriptTo.delete()) {
+ Log.err("Fail to delete file ==> " + removeScriptTo);
+ }
}
if (!PathUtil.moveFile(removeScriptFrom, removeScriptTo)) {
Log.err("Cannot move removeScript to targetDir => "
+ distribution + ", packages : " + packages);
System.out.println("-install option must have some arguements"
+ " you can see usage using '-help'");
- System.exit(0);
+ throw new IMFatalException(ErrorCode.WRONG_OPTION);
}
break;
} else if (arg.equals("-remove")) {
" [-r repository] [-d distribution] [-l SDK target directory(optional)]" +
" [-p meta package ....]");
System.out.println("Usage : InstallManager.bin(exe, sh) [-remove] [-p meta package... | all]");
- System.exit(0);
+ throw new IMFatalException(ErrorCode.WRONG_OPTION);
} else if(arg.equals("-conf")) {
if(iter.hasNext()) {
userConfPath = iter.next();
*/
public void remove(String name, String packageRepo) {
uninstallExtraPackages(packageRepo);
+ removeExtensionPackagesInRepoPackages(packageRepo);
if (contains(packageRepo)) {
userExtensionRepositories.remove(packageRepo);
}
}
/**
+ * Remove extension packages in repository packages by extension repository
+ * which is selected for removing on 'Add Extras' dialog.
+ * @param repo specific extension repository for removing.
+ */
+ private void removeExtensionPackagesInRepoPackages(String repo) {
+ PackageManager pm = InstallManager.getInstance().getPackageManager();
+ PackageSet repoPkgs = pm.getRepoPackages();
+ PackageSet clone = (PackageSet) repoPkgs.clone();
+
+ for (Package pkg : repoPkgs) {
+ if (pkg.getExtensionServer().equalsIgnoreCase(repo)) {
+ clone.remove(pkg);
+ }
+ }
+
+ pm.setRepoPackages(clone);
+ }
+
+ /**
* Uninstall extra packages which belong to selected extra repository.
* @param repo Selected extra repository for removing.
*/
private void makeCacheDir() {
File cacheDir = new File(CACHING_FULL_PATH);
if (!cacheDir.exists()) {
- cacheDir.mkdirs();
+ if (!cacheDir.mkdirs()) {
+ Log.err("Fail to create directory ==> " + cacheDir);
+ }
}
}
private void writeExtraRepoToCache() {
File cacheFile = new File(PathUtil.get(CACHING_DIRECTORY_PATH, CACHING_FILE_NAME));
if (cacheFile.exists()) {
- cacheFile.delete();
+ if (!cacheFile.delete()) {
+ Log.err("Fail to delete file ==> " + cacheFile);
+ }
} else {
try {
cacheFile.createNewFile();
if (size > 0) {// success to download extra package list from repository.
Log.log("Success to download extra package list. ==> " + tmp.getAbsolutePath());
if (extraPkgList.exists()) {
- extraPkgList.delete();
+ if (!extraPkgList.delete()) {
+ Log.err("Fail to delete file ==> " + extraPkgList);
+ }
}
return PathUtil.move(tmp, extraPkgList);
} else { // fail to download extra package list from repository.
// temp file cleanup
if (tmp.exists()) {
- tmp.delete();
+ if (!tmp.delete()) {
+ Log.err("Fail to delete file ==> " + tmp);
+ }
}
return true;
File downloadInstallManagerFile = new File(downloadInstallManagerPath);
if (downloadInstallManagerFile.exists()) {
- downloadInstallManagerFile.delete();
+ if (!downloadInstallManagerFile.delete()) {
+ Log.err("Fail to delete file ==> " + downloadInstallManagerFile);
+ }
}
File parentDir = downloadInstallManagerFile.getParentFile();
if (!parentDir.exists()) {
- parentDir.mkdirs();
+ if (!parentDir.mkdirs()) {
+ Log.err("Fail to create directory ==> " + parentDir);
+ }
}
URL serverIntallManager = null;
File file = new File(path);
if (file.exists()) {
- file.delete();
+ if (!file.delete()) {
+ Log.err("Fail to delete file ==> " + file);
+ }
}
File parentDir = file.getParentFile();
if (!parentDir.exists()) {
- parentDir.mkdirs();
+ if (!parentDir.mkdirs()) {
+ Log.err("Fail to create directory ==> " + parentDir);
+ }
}
URL url = null;
import org.tizen.installmanager.lib.exception.IMNetworkDownloadException;
import org.tizen.installmanager.ui.dialog.LoginDlg;
import org.tizen.installmanager.util.PathUtil;
+import org.tizen.installmanager.util.ResourceHandler;
/**
* Manages downloading from url.
File parentDir = destFile.getParentFile();
if (!parentDir.exists()) {
- parentDir.mkdirs();
+ if (!parentDir.mkdirs()) {
+ Log.err("Fail to create directory ==> " + parentDir);
+ }
}
RandomAccessFile output = null;
} catch (IOException e) {
ErrorController.setErrorMessage(e.getMessage());
Log.ExceptionLog(e);
- return null;
+ ResourceHandler.closeObjectSilently(raFile);
}
return raFile;
.format(startTime) + ".log"));
File parentDir = mLogFile.getParentFile();
if (!parentDir.exists()) {
- parentDir.mkdirs();
+ if (!parentDir.mkdirs()) {
+ Log.err("Fail to create directory ==> " + parentDir);
+ }
}
try {
});
for (int i = 0; i < logs.length - 5; i++) {
- logs[i].delete();
+ if (!logs[i].delete()) {
+ Log.err("Fail to delete file ==> " + logs[i]);
+ }
}
}
File file = new File(REGISTRY_FILE_PATH);
if (file.exists()) {
- file.delete();
+ if (file.delete()) {
+ Log.log("Success to delete file ==> " + file);
+ } else {
+ Log.err("Fail to delete file ==> " + file);
+ }
}
removeOldFiles();
}
if (installedListFile.exists()) {
- installedListFile.delete();
+ if (installedListFile.delete()) {
+ Log.log("Success to delete file ==> " + installedListFile);
+ } else {
+ Log.err("Fail to delete file ==> " + installedListFile);
+ }
}
File installedListDir = installedListFile.getParentFile();
if (!installedListDir.exists()) {
- installedListDir.mkdirs();
+ if (installedListDir.mkdirs()) {
+ Log.log("Success to create directory ==> " + installedListDir);
+ } else {
+ Log.err("Fail to create directory ==> " + installedListDir);
+ }
}
try {
}
if (!targetDir.exists()) {
- targetDir.mkdirs();
+ if (targetDir.mkdirs()) {
+ Log.log("Success to create directory ==> " + targetDir);
+ } else {
+ Log.err("Fail to create directory ==> " + targetDir);
+ }
}
int exitValue;
File parentFile = filePath.getParentFile();
if (!parentFile.exists()) {
- parentFile.mkdirs();
+ if (parentFile.mkdirs()) {
+ Log.log("Success to create directory ==> " + parentFile);
+ } else {
+ Log.err("Fail to create directory ==> " + parentFile);
+ }
}
if (filePath.exists()) {
- filePath.delete();
+ if (filePath.delete()) {
+ Log.log("Success to delete directory ==> " + filePath);
+ } else {
+ Log.err("Fail to delete directory ==> " + filePath);
+ }
}
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
{
Process p=Runtime.getRuntime().exec("df -k");
p.waitFor();
- ipStream = new InputStreamReader(p.getInputStream());
+ ipStream = new InputStreamReader(p.getInputStream(), "UTF-8");
reader = new BufferedReader(ipStream);
String line = reader.readLine();
public void terminateRunningProgram() {
List<Integer> pidList = getSDKPidList();
- for (Integer pid : pidList) {
- String command = "TASKKILL /F /PID " + pid;
- try {
- ShellUtil.execute(command);
- } catch (IMShellCommandFail e) {
- Log.err("Failed to kill "+pid);
- Log.ExceptionLog(e);
- // ignore kill failure
- }
+ if (pidList != null) {
+ for (Integer pid : pidList) {
+ String command = "TASKKILL /F /PID " + pid;
+ try {
+ ShellUtil.execute(command);
+ } catch (IMShellCommandFail e) {
+ Log.err("Failed to kill "+pid);
+ Log.ExceptionLog(e);
+ // ignore kill failure
+ }
+ }
}
- List<Integer> confirmPidList = getSDKPidList();
- if (confirmPidList.size() > 0) {
- ErrorController.setInfoCode(InfoCode.CANNOT_KILL_PROCESS);
+ List<Integer> afterPidList = getSDKPidList();
+
+ if (afterPidList != null) {
+ if (afterPidList.size() > 0) {
+ ErrorController.setInfoCode(InfoCode.CANNOT_KILL_PROCESS);
+ }
}
}
public boolean runningProgramExists() {
List<Integer> pidList = getSDKPidList();
- if (pidList.size() > 0) {
- return true;
+ if (pidList != null) {
+ if (pidList.size() > 0) {
+ return true;
+ } else {
+ return false;
+ }
} else {
return false;
}
}
if (!targetDir.exists()) {
- targetDir.mkdirs();
+ if (targetDir.mkdirs()) {
+ Log.log("Success to create directory ==> " + targetDir);
+ } else {
+ Log.err("Fail to create directory ==> " + targetDir);
+ }
}
unZipPackage(fileFullPath, targetDir, monitor);
File parentFile = targetFile.getParentFile();
if (!parentFile.exists()) {
- parentFile.mkdirs();
+ if (parentFile.mkdirs()) {
+ Log.log("Success to create directory ==> " + parentFile);
+ } else {
+ Log.err("Fail to create directory ==> " + parentFile);
+ }
}
if (targetPath.endsWith("/")) {// zipEntry.isDirectory()) {
- new File(targetPath).mkdir();
+ File target = new File(targetPath);
+ if (target.mkdir()) {
+ Log.log("Success to create directory ==> " + target);
+ } else {
+ Log.err("Fail to create directory ==> " + target);
+ }
zipInStream.closeEntry();
writeFileList(zipEntry.getName());
zipEntry = zipInStream.getNextEntry();
sectionsInstalled= new LinkedList<PropertySection>();
}
- setInstalledPackageList(sectionsInstalled);
+ if (sectionsInstalled != null) {
+ setInstalledPackageList(sectionsInstalled);
+ }
}
/**
}
/**
+ * Set repository packages.
+ * @param packageSet
+ */
+ public void setRepoPackages(PackageSet packageSet) {
+ repoPackages = packageSet;
+ }
+
+ /**
* @return root meta packages of repository
*/
public PackageSet getRootMetaPackagesOfRepository() {
+ PackageSet clone = (PackageSet) repoPackages.clone();
+
+ // Repository packages should not have extension packages.
+ for (Package pkg : repoPackages) {
+ if (pkg.isExtensionPackage()) {
+ clone.remove(pkg);
+ }
+ }
+
+ repoPackages = clone;
+
return rootMeta(repoPackages);
}
}
}
- for(Package rp : repoPackages) {
- if(!recentPackages.contains(rp)) {
- recentPackages.add(rp);
+ if (repoPackages != null) {
+ for(Package rp : repoPackages) {
+ if(!recentPackages.contains(rp)) {
+ recentPackages.add(rp);
+ }
}
}
}
PackageSet packageList = repoPackages;
packageList.addAll(extensionPackages);
- if(packageList.hasPackageByName(pkgName)) {
+ if (packageList.hasPackageByName(pkgName)) {
return packageList.getPackageByName(pkgName);
} else {
return null;
// return null;
// }
}
+
+ public void removePackageFromPackageManager(String pkgName) {
+ PackageSet clone = (PackageSet) repoPackages.clone();
+ Package pkg = clone.getPackageByName(pkgName);
+
+ if (clone.hasPackage(pkg)) {
+ clone.remove(pkg);
+ }
+
+ repoPackages = clone;
+ }
/**
* @param packageNames
* @return packages collected by the given package names
}
if (!parentDir.exists()) {
- parentDir.mkdirs();
+ if (parentDir.mkdirs()) {
+ Log.log("Success to create parent directory ==> " + parentDir);
+ } else {
+ Log.err("Fail to create parent directory ==> " + parentDir);
+ }
}
if (!targetFile.exists()) {
fWriter = new FileWriter(targetPath);
if (properties.size() == 0) {
- targetFile.delete();
+ if (targetFile.delete()) {
+ Log.log("Success to remove file ==> " + targetFile);
+ } else {
+ Log.err("Fail to remove file ==> " + targetFile);
+ }
if (parentDir.getName().equals(".sdkconfig")) {
- parentDir.delete();
+ if (!parentDir.delete()) {
+ Log.err("Fail to delete file ==> " + parentDir);
+ }
}
} else {
for (int i=0;i<properties.size();i++) {
File configFile = new File(configFilePath);
if (configFile.exists()) {
- configFile.delete();
+ if (configFile.delete()) {
+ Log.log("Success to delete configuration file ==> " + configFile);
+ } else {
+ Log.err("Fail to delete configuration file ==> " + configFile);
+ }
}
File parentDir = configFile.getParentFile();
if (!parentDir.exists()) {
- parentDir.mkdirs();
+ if (parentDir.mkdirs()) {
+ Log.log("Success to create parent directory of configuration file ==> " + parentDir);
+ } else {
+ Log.err("Fail to create parent directory of configuration file ==> " + parentDir);
+ }
}
try {
}
public int getSize() {
- int cnt = 0;
-
- for (Package pkg : this) {
- cnt++;
- }
-
- return cnt;
+ return this.size();
}
}
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
* @author Taeyoung Son <taeyoung2.son@samsung.com>
*/
public class InstallManagerWindow extends ApplicationWindow {
- public static final RGB RGB_BACKGROUND = new RGB(242, 242, 242);
+ private static final RGB RGB_BACKGROUND = new RGB(242, 242, 242);
private static final Point POINT_MAIN_WINDOW = new Point(628, 478);
private static Image IMAGE_WINDOW_ICON;
protected static ViewController controller;
private SelectionAdapter cancelBtnSelectionAdapter = null;
private SelectionAdapter closeBtnSelectionAdapter = null;
- protected boolean cancelButtonClicked;
/**
* Create the application window.
extraDialog.open();
if (sl_composite.topControl == compositeInstallablePage) {
- compositeInstallablePage.addExtensionPackagesToExtra(extraDialog.getPackagesFromExtraRepository());
+ compositeInstallablePage.loadPage(controller);
} else if (sl_composite.topControl == compositeUpdatableListPage) {
- compositeUpdatableListPage.addExtensionPackagesToExtra(extraDialog.getPackagesFromExtraRepository());
+ compositeUpdatableListPage.loadPage(controller);
}
}
});
while (iter.hasNext()) {
String key = (String) iter.next();
- String value = env.get(key);
+ Set<Entry<String, String>> value = env.entrySet();
Log.log(key + " = " + value);
}
Log.log("=============================================");
@Override
public void mouseDoubleClick(MouseEvent e) {
Point point = new Point(e.x, e.y);
- TableItem item = snapshotTable.getItem(point);
-
String repo = Config.getInstance().getConfigFile().getRepository();
String dist = distributionCombo.getItem(distributionCombo.getSelectionIndex());
-
+
SnapshotLog snapshotLog = new SnapshotLog(PathUtil.addURLPath(repo, dist));
- String log = snapshotLog.getSnapshotLog(item.getText(TABLE_NAME));
+
+ TableItem item = snapshotTable.getItem(point);
+ String snapshot = null;
+ if (item != null) {
+ snapshot = item.getText(TABLE_NAME);
+ }
+
+ String log = null;
+ if (snapshot != null) {
+ log = snapshotLog.getSnapshotLog(item.getText(TABLE_NAME));
+ }
if (log == null) {
MessageBoxDlg.showDlg(
Snapshot latestSnapshot = controller.getLatestSnapshot(distribution);
if (latestSnapshot != null) {
addLatestItemToSnapshotTable(latestSnapshot);
- }
-
- if (buttonSnapshotFilter.getSelection()) {
- SnapshotList allSnapshots = controller.getSnapshotList(distribution);
-
- if (allSnapshots == null) {
- Log.log("Selected distribution(" + distribution + ") does not exist in repository");
- return;
- }
- for (Snapshot snapshot : allSnapshots) {
- if (!latestSnapshot.equals(snapshot)) {
- addItemToSnapshotTable(snapshot);
+ if (buttonSnapshotFilter.getSelection()) {
+ SnapshotList allSnapshots = controller.getSnapshotList(distribution);
+
+ if (allSnapshots == null) {
+ Log.log("Selected distribution(" + distribution + ") does not exist in repository");
+ return;
}
- }
- } else {
- //add snapshots to table
- SnapshotList snapshots = controller.getManualSnapshotList(distribution);
-
- if (snapshots == null) {
- Log.log("Selected distribution(" + distribution + ") does not exist in repository");
- return;
- }
-
- for (Snapshot snapshot : snapshots) {
- if (!latestSnapshot.equals(snapshot)) {
- addItemToSnapshotTable(snapshot);
+
+ for (Snapshot snapshot : allSnapshots) {
+ if (!latestSnapshot.equals(snapshot)) {
+ addItemToSnapshotTable(snapshot);
+ }
}
- }
+ } else {
+ //add snapshots to table
+ SnapshotList snapshots = controller.getManualSnapshotList(distribution);
+
+ if (snapshots == null) {
+ Log.log("Selected distribution(" + distribution + ") does not exist in repository");
+ return;
+ }
+
+ for (Snapshot snapshot : snapshots) {
+ if (!latestSnapshot.equals(snapshot)) {
+ addItemToSnapshotTable(snapshot);
+ }
+ }
+ }
}
}
if (strDir.endsWith(SDK_IMAGE_ZIP_EXTENSION)) {
imageFile = new File(strDir);
if (validation(strDir)) {
+ Log.log("Package list file found in SDK image => " + strDir);
textLocalServerUrl.setText(strDir);
localErrLabel.setText("");
UNZIP_RESULT unzipResult = unzipSDKImageFile(imageFile);
}
Config.fromWhere = Config.ConfDialog.LOCAL_IMAGE; // it means data from file dialog.
} else {
+ Log.err("Package list file not found is SDK image => " + strDir);
MessageBoxDlg.showDlg(Display.getCurrent().getShells()[0],
"Error",
"No package list file is found in the image file. Check the image file.",
}
if (zipFile != null) {
+ String packageList = PackageManager.getInstance().getPackageListFileName();
+ Log.log("This platform must have package list file as '" + packageList + "'");
- entry = zipFile.getEntry(PackageManager.getInstance().getPackageListFileName());
+ entry = zipFile.getEntry(packageList);
try {
zipFile.close();
File uselessFile = new File(PathUtil.get(unzipTargetDir, Config.BINARY_DIRECTORY));
if (uselessFile.exists()) {
if (uselessFile.isDirectory()) {
- for (File useless : uselessFile.listFiles()) {
- useless.delete();
+ File[] files = uselessFile.listFiles();
+ if (files != null) {
+ for (File useless : files) {
+ if (!useless.delete()) {
+ Log.err("Fail to delete useless file ==> " + useless);
+ }
+ }
}
}
- uselessFile.delete();
+ if (!uselessFile.delete()) {
+ Log.err("Fail to delete file ==> " + uselessFile);
+ }
}
UNZIP_RESULT unzipResult = null;
private long unzipImageFile(Composite composite) {
final File sdkTempDirFile = new File(sdkTempDir);
if (!sdkTempDirFile.exists()) {
- sdkTempDirFile.mkdirs();
+ if (sdkTempDirFile.mkdirs()) {
+ Log.log("Success to create SDK temporary directory " + sdkTempDirFile);
+ } else {
+ Log.err("Fail to create SDK temporary directory " + sdkTempDirFile);
+ }
}
File targetDir = sdkTempDirFile;
File targetFile = new File(targetDir, fileNameToUnzip);
if (zipEntry.isDirectory()) {// Directory case
- targetFile.mkdir(); // Make directory
+ if (!targetFile.mkdir()) { // Make directory
+ Log.err("Fail to create file ==> " + targetFile);
+ }
} else { // File case
// Make parent directory
File parent = new File(targetFile.getParent());
- parent.mkdir();
+ if (!parent.mkdir()) {
+ Log.err("Fail to create file ==> " + parent);
+ }
setProgress(++i, composite, zipEntry.getName()); // Increase progress bar.
unzipEntry(zis, targetFile);
}
for (Item childItem : getChildren()) {
childItem.getTerminalPackages(installList, checked);
}
- }
+ }
if (getChildren().size() <= 0) {
if (getCheckState() == CheckState.CHECKED) {
if (instType == InstallType.TYPICAL) {
iType = TYPICAL_PACKAGE_NAME;
- installType = InstallType.TYPICAL;
} else if (instType == InstallType.MINIMAL) {
iType = MINIMAL_PACKAGE_NAME;
- installType = InstallType.MINIMAL;
} else if (instType == InstallType.WEB_MINIMAL) {
iType = WEB_MINIMAL_PACKAGE_NAME;
- installType = InstallType.WEB_MINIMAL;
} else if (instType == InstallType.NATIVE_MINIMAL) {
iType = NATIVE_MINIMAL_PACKAGE_NAME;
- installType = InstallType.NATIVE_MINIMAL;
- } else {
- installType = InstallType.CUSTOM;
}
-
+
setCheckedByType(iType);
checkboxTreeViewer.refresh();
checkboxTreeViewer.getTree().setEnabled(false);
+ convertToVolumeSize(getCheckedPackageSize(false)));
lblUncompressedSize.setText("Install size : "
+ convertToVolumeSize(getCheckedPackageSize(true)));
-
- setNextBtnEnabledAboutCheckedPackageCount();
+ setNextBtnEnabledAboutCheckedPackageCount();
}
/**
if (installType == null || installType.isEmpty()) {
Log.err("Install type is empty. check install type or package server is old.");
}
+
Package pkg = InstallManager.getInstance().getPackageManager().getPackageByName(installType);
if (pkg == null) {
TYPICAL, MINIMAL, WEB_MINIMAL, NATIVE_MINIMAL, CUSTOM
}
- protected InstallType installType;
-
/**
* Set environments for packagelist page, such as style, adding listener.
*
msg = "test";
} else {
msg = "This package is conflict package of\n";
-
+ List<String> causePkgs = new ArrayList<String>();
for (Package pkg : causePackages) {
- msg += "'" + pkg.getPackageName() + "'\n";
+ causePkgs.add(pkg.getPackageName());
}
+ msg = "'" + causePkgs + "'\n";
}
MessageBoxDlg.showDlg(Display.getCurrent().getShells()[0],
private void removeChildrenOfExtra() {
Item extraItem = getExtraTreeItem();
- for (Item childItem : extraItem.getChildren()) {
- removeTreeItem(childItem);
+ if (extraItem != null) {
+ if (extraItem.getChildren() != null) {
+ for (Item childItem : extraItem.getChildren()) {
+ removeTreeItem(childItem);
+ }
+ }
+ extraItem.clearChildrenItems();
}
-
- extraItem.clearChildrenItems();
}
private void removeTreeItem(Item item) {
private Label spaceRequiredLabel;
private Label spaceAvailableLabel;
private Button selectPathBtn;
- public ViewController viewController = null;
private long requiredSpace = 0;
private File selectedDisk = null;
*/
public boolean loadPage(ViewController controller, long requiredSize) {
boolean result = true;
- viewController = controller;
requiredSpace = requiredSize;
InstallManagerWindow.setNextBtnEnabled(checkAvailablePath());
long usableSpace = file.getUsableSpace();
- if (usableSpace == 0) {
+ if (usableSpace == 0 && root != null) {
usableSpace = root.getUsableSpace();
}
//get all meta packages (installable packages)
//TODO : show all packages. (installable, installed)
- PackageSet metaPackageSet = packageManager.getRootMetaPackagesOfRepository();
+ PackageSet metaPackageSet = packageManager.getRootMetaPackagesOfRepository();
return makeTreeItem(metaPackageSet);
}
* @return There are packages to install or remove, return true. if not false.
*/
public boolean existInstallableOrRemovablePackages() {
- return (getRemovablePackageList().size() > 0 || getInstallableOrUpdatableMetaPackages().size() > 0);
+ PackageSet rmPkgs = getRemovablePackageList();
+ PackageSet insPkgs = getInstallableOrUpdatableMetaPackages();
+
+ if (rmPkgs != null || insPkgs != null) {
+ return (getRemovablePackageList().size() > 0 || getInstallableOrUpdatableMetaPackages().size() > 0);
+ } else {
+ return false;
+ }
}
/**
* @return There are packages to install or remove, return true. if not false.
*/
public boolean existInstallableOrUpdatablePackages() {
- if (Options.snapshot || Config.fromWhere == Config.ConfDialog.LOCAL_IMAGE) {
- return (getInstallablePackageListInSnapshot().size() > 0);
+ PackageSet ps = getInstallablePackageListInSnapshot();
+
+ if (ps != null) {
+ if (Options.snapshot || Config.fromWhere == Config.ConfDialog.LOCAL_IMAGE) {
+ return (ps.size() > 0);
+ } else {
+ return (ps.size() > 0);
+ }
} else {
- return (getInstallableOrUpdatableMetaPackages().size() > 0);
+ return false;
}
}
* @return
*/
public static String getParentDirectory(String path, int parentDepth) {
- for (int i=parentDepth; i>0; i--) {
- path = PathUtil.getParentDirectory(path);
+ String parentPath = null;
+
+ if (path != null) {
+ for (int i = parentDepth; i > 0; i--) {
+ parentPath = PathUtil.getParentDirectory(path);
+ }
}
- return path;
+
+ return parentPath;
}
/**
if (!fromFile.isDirectory()) {
if (toFile.isDirectory() && !toFile.exists()) {
- toFile.mkdirs();
- toFile = new File(PathUtil.get(toFile.getAbsolutePath(), fromFile.getName()));
+ if (toFile.mkdirs()) {
+ toFile = new File(PathUtil.get(toFile.getAbsolutePath(), fromFile.getName()));
+ Log.log("Success to create " + toFile);
+ } else {
+ Log.err("Fail to create " + toFile);
+ }
} else if (toFile.isDirectory() && toFile.exists()) {
toFile = new File(PathUtil.get(toFile.getAbsolutePath(), fromFile.getName()));
}
if (toFile.exists()) {
- toFile.delete();
+ if (toFile.delete()) {
+ Log.log("Success to delete " + toFile);
+ } else {
+ Log.err("Fail to create " + toFile);
+ }
}
return copyFile(fromFile, toFile);
return false;
} else {
if (!toFile.exists()) {
- toFile.mkdirs();
+ if (!toFile.mkdirs()) {
+ Log.err("Fail to create file ==> " + toFile);
+ }
}
File[] fileList = fromFile.listFiles();
}
if (!to.exists()) {
- to.createNewFile();
+ if (to.createNewFile()) {
+ Log.log("Success to create " + to);
+ } else {
+ Log.err("Fail to create " + to);
+ }
}
FileInputStream fInput = null;
* @throws IOException
*/
public static void writeFileFromInputStream(InputStream is, File to) throws IOException {
- Log.log("write file from input stream to : "+to);
+ Log.log("write file from input stream to : " + to);
if (is == null) {
return;
}
if (!to.exists()) {
- to.createNewFile();
+ if (to.createNewFile()) {
+ Log.log("Success to create " + to + ".");
+ } else {
+ Log.err("Fail to create " + to + ".");
+ }
}
FileOutputStream os = null;
try {
File parentDir = toFile.getParentFile();
if (!parentDir.exists()) {
- parentDir.mkdirs();
+ if (parentDir.mkdirs()) {
+ Log.log("Success to create parent directory ==> " + parentDir);
+ } else {
+ Log.err("Fail to create parent directory ==> " + parentDir);
+ }
}
return move(fromFile, toFile);
}
if (toFile.exists()) {
if (toFile.isFile()) {
- toFile.delete();
+ if (toFile.delete()) {
+ Log.log("Success to delete " + toFile);
+ } else {
+ Log.log("Fail to delete " + toFile);
+ }
return fromFile.renameTo(toFile);
} else {
File[] files = fromFile.listFiles();
if (filePath.isDirectory()) {
File[] listFile = filePath.listFiles();
-
- for (File childFile : listFile) {
- ret = removeForWindows(childFile) && ret;
+ if (listFile != null) {
+ for (File childFile : listFile) {
+ ret = removeForWindows(childFile) && ret;
+ }
}
-
}
System.gc(); // delete() method does not work exactly sometimes. so, there is gc() before delete().
The licenses of all proprietary components contributed from companies other than Samsung will be either displayed as part of their respective installers or accessed inside installation package archive of each component.
You may access and download Tizen SDK Open Source Software at:
-http://developer.tizen.org/download/tizenopensdk.tar.gz
+https://developer.tizen.org/downloads/tizen-sdk
BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS, THE SAMSUNG TIZEN SDK LICENSE AGREEMENT AND THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED FROM COMPANIES OTHER THAN SAMSUNG. If you do not agree with the Open Source Software license terms or the SAMSUNG TIZEN SDK LICENSE AGREEMENT or THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED FROM COMPANIES OTHER THAN SAMSUNG, you may not download or use Tizen SDK.
\ No newline at end of file