1 30 package com.genimen.djeneric.util; 31 32 import java.io.File ; 33 34 public class DjEnvironment 35 { 36 public static String getDjenericDir() 37 { 38 String djDir = System.getProperty("user.home") + File.separator + ".djeneric"; 39 File chk = new File (djDir); 40 if (!chk.exists()) createDirectory(djDir); 41 return djDir; 42 } 43 44 public static String getAbsoluteFileName(String propertyFileName) 45 { 46 return getDjenericDir() + File.separator + propertyFileName; 47 } 48 49 public static void createDirectory(String dir) 50 { 51 try 52 { 53 File fd; 54 if (dir.endsWith("/") || dir.endsWith("\\")) 55 { 56 fd = new File (dir.substring(0, dir.length() - 1)); 57 fd.mkdirs(); 58 } 59 else 60 { 61 fd = new File (dir); 62 fd.mkdirs(); 63 } 64 } 65 catch (Exception iox) 66 { 67 DjLogger.log("createDirectory " + dir + ": " + iox.getMessage()); 68 } 69 } 70 } | Popular Tags |