ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive Zip.java
Date Mon, 18 Feb 2002 08:45:07 GMT
donaldp     02/02/18 00:45:07

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive
                        Zip.java
  Log:
  Remove some audit warnings
  
  Revision  Changes    Path
  1.4       +27 -18    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/archive/Zip.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Zip.java	6 Feb 2002 13:38:21 -0000	1.3
  +++ Zip.java	18 Feb 2002 08:45:07 -0000	1.4
  @@ -111,7 +111,7 @@
       /**
        * Sets whether we want to compress the files or only store them.
        *
  -     * @param c The new Compress value
  +     * @param compress The new Compress value
        */
       public void setCompress( final boolean compress )
       {
  @@ -146,8 +146,6 @@
   
       /**
        * Emulate Sun's jar utility by not adding parent dirs
  -     *
  -     * @param f The new Filesonly value
        */
       public void setFilesonly( final boolean filesonly )
       {
  @@ -157,8 +155,6 @@
       /**
        * Sets whether we want to update the file (if it exists) or create a new
        * one.
  -     *
  -     * @param c The new Update value
        */
       public void setUpdate( final boolean update )
       {
  @@ -527,15 +523,12 @@
           }
           for( int i = 0; i < dirs.length; i++ )
           {
  -            if( "".equals( dirs[ i ] ) )
  +            final String dir = dirs[ i ];
  +            if( "".equals( dir ) )
               {
                   continue;
               }
  -            String name = dirs[ i ].replace( File.separatorChar, '/' );
  -            if( !name.endsWith( "/" ) )
  -            {
  -                name += "/";
  -            }
  +            final String name = getName( dir );
               addParentDirs( thisBaseDir, name, zOut, prefix );
           }
   
  @@ -564,6 +557,16 @@
           }
       }
   
  +    private String getName( final String dir )
  +    {
  +        String name = dir.replace( File.separatorChar, '/' );
  +        if( !name.endsWith( "/" ) )
  +        {
  +            name += "/";
  +        }
  +        return name;
  +    }
  +
       /**
        * Iterate over the given ArrayList of (zip)filesets and add all files to the
        * ZipOutputStream using the given prefix or fullpath.
  @@ -587,16 +590,10 @@
               if( fs instanceof ZipFileSet )
               {
                   ZipFileSet zfs = (ZipFileSet)fs;
  -                prefix = zfs.getPrefix();
  +                prefix = getPrefix( zfs.getPrefix() );
                   fullpath = zfs.getFullpath();
               }
   
  -            if( prefix.length() > 0
  -                && !prefix.endsWith( "/" )
  -                && !prefix.endsWith( "\\" ) )
  -            {
  -                prefix += "/";
  -            }
   
               // Need to manually add either fullpath's parent directory, or
               // the prefix directory, to the archive.
  @@ -621,6 +618,18 @@
                   addFiles( ds, zOut, prefix, fullpath );
               }
           }
  +    }
  +
  +    private String getPrefix( final String prefix )
  +    {
  +        String result = prefix;
  +        if( result.length() > 0
  +            && !result.endsWith( "/" )
  +            && !result.endsWith( "\\" ) )
  +        {
  +            result += "/";
  +        }
  +        return result;
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message