PackageManager pm = PackageManager.getInstance();
String targetDir = getTargetDir();
- Registry.sdkWorkSpacePath = getSDKDataPath();
+ Registry.sdkDataPath = getSDKDataPath();
Config.USER_CONFIG_HOME_PATH = getSDKDataPath();
PackageSet skipPackages = pm.getPackagesByNames(Options.skipPackages);
installablePackages = pm.diff(installablePackages, skipPackages);
}
+ Registry.saveSDKInfo(targetDir);
+
if (checkAvailableSize(installablePackages, targetDir)) {
return installPackages(installablePackages, targetDir);
} else {
private ConfigFile mConfigFile = null;
private ConfigFile currentConfigFile = null;
private String mTargetDir = "";
+ private String mSdkDataDir = "";
private static Config config = null;
public void setTargetDir(String targetDir) {
mTargetDir = targetDir;
}
+
+ /**
+ * Set target directory to member variable.
+ *
+ * @param targetDir
+ */
+ public void setSdkDatatDir(String dataDir) {
+ mSdkDataDir = dataDir;
+ }
/**
* Get ConfigFile Class instance
public String getTargetDir() {
return mTargetDir;
}
+
+ /**
+ * @return path of target directory
+ */
+ public String getSdkDataDir() {
+ return mSdkDataDir;
+ }
/**
* @return <code>true</code> if proxy server is specified
if (!Registry.getInstalledPath().isEmpty()) {
mConfig.setTargetDir(Registry.getInstalledPath());
}
+ mConfig.setSdkDatatDir(Registry.getSdkDataPath());
}
}
*/
private void setCurrentSDKEnvironment(String targetPath) {
Log.log("Set new SDK environment from old SDK.");
- Registry.sdkWorkSpacePath = Config.getConfigHome();
+ Registry.sdkDataPath = Config.getConfigHome();
if (targetPath == null || targetPath.isEmpty()) {
Log.err("Install path is invalid: " + targetPath
}
mConfig.setTargetDir(targetDir);
+ mConfig.setSdkDatatDir(Registry.sdkDataPath);
Performance.setDownloadStartTime();
// Keep target path for later use
mConfig.setTargetDir(targetDir);
+ mConfig.setSdkDatatDir(Registry.sdkDataPath);
// Make .info directory
if (!mConfig.makeInfoDirectory()) {
//sdk configuration file
final static public String SDK_DATA_DIR_NAME = "tizen-sdk-data";
- final static public String SDK_DATA_PATH = getSDKDataPath();
+// final static private String SDK_DATA_PATH = getSDKDataPath();
final static public String SDK_CONFIGURATION_DIR = ".info";
final static public String SDK_INFORMATION_FILE_NAME = "sdk.info";
final static public String SDK_INSTALLED_PACKAGE_LIST_FILE = "installedpackage.list";
//test file
final static public String SDK_TEST_DIR_NAME = "test";
- final static public String SDK_INSTALLMANAGER_TEST_RESULT_DIR_PATH = PathUtil.get(SDK_DATA_PATH, SDK_TEST_DIR_NAME, INSTALLMANAGER_DIRECTORY_NAME);
+// final static public String SDK_INSTALLMANAGER_TEST_RESULT_DIR_PATH = PathUtil.get(SDK_DATA_PATH, SDK_TEST_DIR_NAME, INSTALLMANAGER_DIRECTORY_NAME);
static String getInstallManagerBinaryName() {
}
}
+ static String getInstallManagerTestResultPath() {
+ return PathUtil.get(getSDKDataPath(), SDK_TEST_DIR_NAME, INSTALLMANAGER_DIRECTORY_NAME);
+ }
+
static String getSDKDataPath() {
- if (Platform.isLinux() || Platform.isMacOS()) {
- return PathUtil.getFromHome(SDK_DATA_DIR_NAME);
- } else if (Platform.isWindows()) {
- return PathUtil.getFromAppData(SDK_DATA_DIR_NAME);
+ if (Config.getInstance().getSdkDataDir() == "") {
+ if (Platform.isLinux() || Platform.isMacOS()) {
+ return PathUtil.getFromHome(SDK_DATA_DIR_NAME);
+ } else if (Platform.isWindows()) {
+ return WINDOWS_DEFAULT_DATA_PATH;
+ } else {
+ throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
+ }
} else {
- throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
+ return Config.getInstance().getSdkDataDir();
}
}
HashMap<String, String> env = new HashMap<String, String>();
env.put("INSTALLED_PATH", Registry.getInstalledPath());
- env.put("SDK_DATA_PATH", Registry.sdkWorkSpacePath);
- env.put("USER_DATA_PATH", Registry.sdkWorkSpacePath);
+ env.put("SDK_DATA_PATH", Registry.sdkDataPath);
+ env.put("USER_DATA_PATH", Registry.sdkDataPath);
env.put("MAKESHORTCUT_PATH", InstallManager.getInstance().getMakeShortCutPath());
env.put("REMOVE_SHORTCUT", InstallManager.getInstance().getRemoveShortCutPath());
env.put("TSUDO", InstallManager.getInstance().getTSudoPath());
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
String testFileName = formatter.format(imStartTime) + ".txt";
- String testResultFilePath = PathUtil.get(InstallManagerConstants.SDK_INSTALLMANAGER_TEST_RESULT_DIR_PATH, testFileName);
+ String testResultFilePath = PathUtil.get(InstallManagerConstants.getInstallManagerTestResultPath(), testFileName);
File testResultFile = new File(testResultFilePath);
if (!testResultFile.getParentFile().exists()) {
private static final String REGISTRY_SEPERATOR = "=";
public static String targetPath = "";
- public static String sdkWorkSpacePath = "";
+ public static String sdkDataPath = "";
+// public static String sdkDataPath = getSDKinfoBySDKPath(Config.getInstance().getTargetDir());
private static ArrayList<String> sdkPathList = getSDKPath();
/**
}
}
+ /**
+ * @return path in which SDK is installed. empty string if not found.
+ */
+ public static String getSdkDataPath() {
+ return getPathFromRegistryKey(PathUtil.get(Registry.getInstalledPath(),
+ InstallManagerConstants.SDK_INFORMATION_FILE_NAME)
+ , SDK_DATA_PATH_KEY);
+ }
+
public static String getOldInstalledPath() {
return getPathFromRegistryKey(OLD_REGISTRY_FILE_PATH, INSTALLED_PATH_KEY);
}
/**
* When installmanager updates SDK, installmanager have to know sdk information from sdk.info file.
* @param sdkPath
+ * @return
*/
public static void setSDKinfoBySDKPath(String sdkPath) {
File sdkInfoFile = new File(PathUtil.get(sdkPath, InstallManagerConstants.SDK_INFORMATION_FILE_NAME));
if (sdkInfoFile.exists()) {
- sdkWorkSpacePath = getPathFromRegistryKey(sdkInfoFile.getAbsolutePath(), SDK_DATA_PATH_KEY);
+ sdkDataPath = getPathFromRegistryKey(sdkInfoFile.getAbsolutePath(), SDK_DATA_PATH_KEY);
Log.log("sdk.info file exists. => " + sdkPath);
Log.log("InstallManager can set sdk environment.");
} else {
*/
public static void saveSDKInfo(String installPath) {
if (installPath == null || installPath.isEmpty() ||
- sdkWorkSpacePath == null || sdkWorkSpacePath.isEmpty()) {
+ sdkDataPath == null || sdkDataPath.isEmpty()) {
Log.err("Install path or workspace path is invalid: " + installPath
+ ". This might be a bug of IM");
throw new IMFatalException(ErrorCode.INVALID_INSTALL_PATH);
String sdkInfoPath = PathUtil.get(installPath, InstallManagerConstants.SDK_INFORMATION_FILE_NAME);
String target = INSTALLED_PATH_KEY + REGISTRY_SEPERATOR + installPath;
- String workSpace = SDK_DATA_PATH_KEY + REGISTRY_SEPERATOR + sdkWorkSpacePath;
+ String workSpace = SDK_DATA_PATH_KEY + REGISTRY_SEPERATOR + sdkDataPath;
File sdkInfoFile = null;
try {
boolean installable = compositeSetInstallDirectoryPage.isInstallablePath();
Config.USER_CONFIG_HOME_PATH = compositeSetInstallDirectoryPage.getSDKWorkSpacePath();
- Registry.sdkWorkSpacePath = controller.getSDKWorkSpacePath();
+ Registry.sdkDataPath = controller.getSDKWorkSpacePath();
Registry.targetPath = controller.getInstallPath();
Registry.saveSDKInfo(Registry.targetPath);
return packageManager.getInstallablePackages(selectedMetas);
}
-
- private PackageSet getMetaPackagesByPurpose(PackageSet metaPackages) {
- String userAttribute = Options.purposeOfInstalling;
- for (Package pkg : metaPackages) {
- String attribute = pkg.getAttribute();
-
- if (!pkg.isRootMeta() && !pkg.isExtraMeta() && !pkg.isMandatory()) {
- if (!attribute.equalsIgnoreCase(userAttribute)) {
- metaPackages.remove(pkg);
- }
- }
- }
-
- return metaPackages;
- }
/**
* Start to uninstall