} catch (UnsupportedEncodingException e) {
Log.ExceptionLog(e);
return encodeRepository;
- }
+ }
- String downloadPath = PathUtil.get(Config.INSTALL_MANAGER_TEMP_DIRECTORY,
- INSTALL_MANAGER_DOWNLOAD_DIRECTORY_NAME, encodeRepository);
- return downloadPath;
+ return PathUtil.get(getDownloadDirPath(), encodeRepository);
+ }
+
+ /**
+ * get downloaded directory path
+ * @return
+ */
+ public String getDownloadDirPath() {
+ if (mTargetDir == null || mTargetDir.isEmpty()) {
+ return PathUtil.get(Config.INSTALL_MANAGER_TEMP_DIRECTORY,
+ INSTALL_MANAGER_DOWNLOAD_DIRECTORY_NAME);
+ } else {
+ return PathUtil.get(
+ mTargetDir,
+ InstallManagerConstants.SDK_CONFIGURATION_DIR,
+ INSTALL_MANAGER_DOWNLOAD_DIRECTORY_NAME);
+ }
}
public static void setSelectedSDKPath(String path) {
}
}
- releaseTargetDirectory();
+ if (bResult) {
+ PathUtil.remove(Config.getInstance().getDownloadDirPath());
+ }
+
return bResult;
}
return makeTreeItem(metaPackageSet);
}
- public void lockTargetDirectory(String targetDir) throws IOException{
- File targetFile = new File(PathUtil.get(targetDir, InstallManagerConstants.SDK_INFORMATION_FILE_NAME));
-
- if (!targetFile.exists()) {
- return;
- }
-
- try {
- channel = new RandomAccessFile(targetFile, "rw").getChannel();
- } catch (FileNotFoundException e) {
- Log.ExceptionLog(e);
- return;
- }
-
- lock = channel.tryLock();
- }
-
- public void releaseTargetDirectory() {
- try {
- if (lock != null) {
- lock.release();
- }
- } catch (IOException e) {
- Log.ExceptionLog(e);
- }
-
- try {
- if (channel != null) {
- channel.close();
- }
- } catch (IOException e) {
- Log.ExceptionLog(e);
- }
- }
-
/**
* Make tree item from package set.
* @param pkgSet