You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2001/08/11 04:52:45 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/io FileUtil.java

larryi      01/08/10 19:52:45

  Modified:    src/share/org/apache/tomcat/util/io FileUtil.java
  Log:
  Move getConfigFile() to FileUtil to support reuse
  
  Revision  Changes    Path
  1.5       +23 -3     jakarta-tomcat/src/share/org/apache/tomcat/util/io/FileUtil.java
  
  Index: FileUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/io/FileUtil.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileUtil.java	2001/04/22 05:38:17	1.4
  +++ FileUtil.java	2001/08/11 02:52:45	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/io/FileUtil.java,v 1.4 2001/04/22 05:38:17 costin Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/04/22 05:38:17 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/io/FileUtil.java,v 1.5 2001/08/11 02:52:45 larryi Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/08/11 02:52:45 $
    *
    * ====================================================================
    *
  @@ -432,5 +432,25 @@
       }
   
   
  +    public static File getConfigFile( File base, File configDir, String defaultF )
  +    {
  +        if( base==null )
  +            base=new File( defaultF );
  +        if( ! base.isAbsolute() ) {
  +            if( configDir != null )
  +                base=new File( configDir, base.getPath());
  +            else
  +                base=new File( base.getAbsolutePath()); //??
  +        }
  +        File parent=new File(base.getParent());
  +        if(!parent.exists()){
  +            if(!parent.mkdirs()){
  +                throw new RuntimeException(
  +                    "Unable to create path to config file :"+
  +                    base.getAbsolutePath());
  +            }
  +        }
  +        return base;
  +    }
   
   }