tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util FileUtil.java
Date Thu, 01 Feb 2001 06:17:41 GMT
costin      01/01/31 22:17:41

  Modified:    src/share/org/apache/tomcat/util FileUtil.java
  Log:
  Added getFileBase() ( I wanted to fix what ServerXmlInterceptor was doing,
  but since it's a general-purplose util I moved it to FileUtil )
  
  Revision  Changes    Path
  1.18      +24 -3     jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java
  
  Index: FileUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- FileUtil.java	2000/12/29 00:20:27	1.17
  +++ FileUtil.java	2001/02/01 06:17:41	1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v 1.17
2000/12/29 00:20:27 costin Exp $
  - * $Revision: 1.17 $
  - * $Date: 2000/12/29 00:20:27 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v 1.18
2001/02/01 06:17:41 costin Exp $
  + * $Revision: 1.18 $
  + * $Date: 2001/02/01 06:17:41 $
    *
    * ====================================================================
    *
  @@ -344,6 +344,27 @@
   	    return path.substring(i);
   	else
   	    return null;
  +    }
  +
  +    /** Name without path and extension. 
  +     */
  +    public static String getBase( String path ) {
  +        int i = path.lastIndexOf(".");
  +	int j = path.lastIndexOf("/");
  +
  +	if( j < 0 ) {// no /
  +	    if( i<0 )
  +		return path;
  +	    else
  +		return path.substring( 0, i );
  +	} else {
  +	    if( i<j ) {
  +		// . in a dir, before last component, or no "."
  +		return path.substring( j );
  +	    } else {
  +		return path.substring( j, i );
  +	    }
  +	}
       }
   
       public static void expand( String src, String dest)
  
  
  

Mime
View raw message