Page 3 of 3

Posted: Tue May 16, 2006 8:55 am
by NRGizeR
Hmm... just had a look at the code, and I can't really see how to do this differently, and I also tried to compare the listings of a "regular" .zip file and one created with bsppack, and they both look identical to me (both have entries for folders as well, and not only files) I guess the directory entries could, in principal, be removed, but if I remember correctly, I tried this and it doesn't work.

This is the actual function that compresses the files...

oh, and to you coders, before you say anything, I know, I know, big no no to have files as a classglobal variable :) I was still learning code design when writing this :) then again, I still am ;)

Code: Select all

   protected void compressFiles(File zip) throws IOException
   {
      ZipOutputStream zo = new ZipOutputStream(new FileOutputStream(zip));

      for (int i = 0; i<files.size(); i++)
      {
         byte b[] = new byte[512];
         FileHolder fh = (FileHolder) files.get(i);
         fh.setName(fh.getName().replace(File.separatorChar, '/'));

         /* NOTE!!!!! it seems as if linux doesn't search for the correct cased names after
          * all, but tried to find the lower case versions of the needed files... therefore,
          * the .toLowerCase() will make sure that the all files in the .zip are in  lowercase...
          */

         ZipEntry ze = new ZipEntry(fh.getName().toLowerCase());
         zo.putNextEntry(ze);
         if (!ze.isDirectory())
         {
            int len = 0;
            try
            {
               InputStream in = new FileInputStream(fh.getFile());
               while ((len = in.read(b)) != -1)
               {
                  zo.write(b,0,len);
               }
            }
            catch (IOException e)
            {
               e.printStackTrace();
            }
         }
         zo.closeEntry();

         if (ze.getSize() > 0) sysout.print("Deflated ("+((ze.getCompressedSize()*100)/ze.getSize())+"%):\t"+fh.getName()+"...");
      }
      zo.close();
      sysout.print("Done...");
   }
Then again, if windows explorer is the only program that fucks up, I'm very prone to write this off as a windows explorer problem. (I trust winzip and unzip more than windows explorer any day :P )

Posted: Tue Oct 17, 2006 9:39 am
by NRGizeR
Hey,

I have another (small) update to BSPPack, that should fix the problem that people are experiencing with newer WinZip versions (as well as the integrated .zip support in winxp) It's still weird that not all .zip applications choke (or alternatively work) on the old bsppacked files. Oh well, here it is, hope it works and do tell if it doesn't.

http://www.abo.fi/~cbjorkel/apps/BSPPack.zip

P.S. Read the first post in this thread for usage information if you don't know how to use it.

Posted: Wed Oct 18, 2006 3:07 pm
by NRGizeR
Hmm... this fix made another bug come into the limelight, and I've yet to fix that one, since I cannot reproduce this error myself. It's tedious work trying different fixes, and then repackaging, sending out to the tester, and then redoing the bughunt, but I'll try to get this done asap. In the meantime, do check the .zip files before releasing them, as some .zip applications still seem to have problems with the bsppackaged files :(

Posted: Thu Oct 19, 2006 11:35 am
by NRGizeR
Now everything seems to be working again. Haven't gotten hold of anyone using winzip to confirm that the new version still works ok on winzip, but I haven't touched that code again, so I hope that no freak of nature (code?) messed that one up again. Get the new version 1.33 at the same place, the .zip has been replaced.

http://www.abo.fi/~cbjorkel/apps/BSPPack.zip

Posted: Fri Jan 25, 2008 1:04 pm
by skmz
Oops, it has passed over 2 years since the last post in this thread. Since it's already sticky, there's no need for any free bump, but I'd like to say that it's an awesome program, really. Greatly done!