[Title] change the directory location to download packages.
authorshihyun <shihyun@shihyun-Samsung-Desktop-System.(none)>
Mon, 8 Jul 2013 08:29:20 +0000 (17:29 +0900)
committershihyun <shihyun@shihyun-Samsung-Desktop-System.(none)>
Mon, 8 Jul 2013 08:29:20 +0000 (17:29 +0900)
InstallManager_java/src/org/tizen/installmanager/core/Config.java
InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java

index a0c66ef..e79e40d 100644 (file)
@@ -658,11 +658,25 @@ public class Config {
                } 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) {
index 3af54cc..ef90eb5 100644 (file)
@@ -332,7 +332,10 @@ public class ViewController {
                        }
                }
                
-               releaseTargetDirectory();
+               if (bResult) {
+                       PathUtil.remove(Config.getInstance().getDownloadDirPath());
+               }
+               
                return bResult;
        }
        
@@ -457,41 +460,6 @@ public class ViewController {
                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