From 27d5bd9417c6b1a36336b56d8eb096aacf3a8b33 Mon Sep 17 00:00:00 2001 From: Son Hyunjun Date: Sun, 18 Mar 2012 04:07:25 +0900 Subject: [PATCH] [Title] create skin log file path if not exists [Type] Bugfix [Module] [Priority] Minor [CQ#] [Redmine#] [Problem] [Cause] [Solution] Change-Id: I9b97400a5b40d3c6af508b4775f040604c3db4e4 --- .../org/tizen/emulator/skin/log/SkinLogger.java | 25 ++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/log/SkinLogger.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/log/SkinLogger.java index 8e345c9..a02683b 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/log/SkinLogger.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/log/SkinLogger.java @@ -95,13 +95,30 @@ public class SkinLogger { String path = ""; if( !StringUtil.isEmpty( filePath ) ) { - path = filePath; + path = filePath + File.separator; } + + File dir = new File( path + LOG_FOLDER ); + dir.mkdir(); + File file = new File( dir + File.separator + FILE_NAME ); + if( !file.exists() ) { + try { + if( !file.createNewFile() ) { + System.err.println( "[SkinLog:error]Cannot create skin log file. path:" + file.getAbsolutePath() ); + System.exit( -1 ); + return; + } + } catch ( IOException e ) { + e.printStackTrace(); + System.exit( -1 ); + return; + } + } + try { - path = path + File.separator + LOG_FOLDER + File.separator + FILE_NAME; - System.out.println( "[SkinLog]log file path:" + path ); - fileHandler = new FileHandler( path, false ); + System.out.println( "[SkinLog]log file path:" + file.getAbsolutePath() ); + fileHandler = new FileHandler( file.getAbsolutePath(), false ); } catch ( SecurityException e1 ) { e1.printStackTrace(); } catch ( IOException e1 ) { -- 2.7.4