CLI: Fixed a bug where deleting temporary files on windows fails 38/16038/1
authorshingil.kang <shingil.kang@samsung.com>
Wed, 5 Feb 2014 11:54:17 +0000 (20:54 +0900)
committershingil.kang <shingil.kang@samsung.com>
Wed, 5 Feb 2014 11:54:17 +0000 (20:54 +0900)
Deleting files works properly after closing file handler

Change-Id: I0bc059fb6c62f7bc60182c610ad32f2ac51f0de9
Signed-off-by: shingil.kang <shingil.kang@samsung.com>
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java

index abbc1ac..85579b2 100644 (file)
@@ -800,6 +800,8 @@ class ProjectGenUtil
         Scanner scanner = null;
 
         String newLine = System.getProperty("line.separator");
+        File destConfigFile = null;
+        File outputConfigFile = null;
 
         try
         {
@@ -823,18 +825,18 @@ class ProjectGenUtil
                 }
             }
 
-            File destConfigFile = new File(destConfigPath);
-            File outputConfigFile = new File(destConfigPath + ".output");
-
-            destConfigFile.delete();
-            outputConfigFile.renameTo(destConfigFile);
-
+            destConfigFile = new File(destConfigPath);
+            outputConfigFile = new File(destConfigPath + ".output");
         } catch (IOException e)
         {
             logger.error(e.getMessage());
         } finally
         {
             IOUtil.tryClose(scanner, out);
+            if(null != destConfigFile)
+                destConfigFile.delete();
+            if(null != outputConfigFile)
+                outputConfigFile.renameTo(destConfigFile);
         }
 
     }