From fda3f4ed1d0d3fd16a7c4e9aa416f65512b1d838 Mon Sep 17 00:00:00 2001 From: "shingil.kang" Date: Wed, 5 Feb 2014 20:54:17 +0900 Subject: [PATCH] CLI: Fixed a bug where deleting temporary files on windows fails Deleting files works properly after closing file handler Change-Id: I0bc059fb6c62f7bc60182c610ad32f2ac51f0de9 Signed-off-by: shingil.kang --- .../ncli/ide/subcommands/CreateWebProjectCommand.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java index abbc1ac..85579b2 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java @@ -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); } } -- 2.7.4