Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8286631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:49:46+00:00 2026-06-08T11:49:46+00:00

I’ve recently decided to write a launcher for my project. It simply downloads updated

  • 0

I’ve recently decided to write a launcher for my project. It simply downloads updated files from my server, unpacks them, merges some of the files (because their content varies on settings of the launcher) and packs them into one .zip file.

I’m sure the downloading and merging processes work perfectly, but the last one – zipping – doesn’t.

Here’s my code for zipping:

— Here’s where my not working code was. —

The .zip file is created correctly, but when I put it into the game dir, the game won’t start (says it’s corrupted). But if I open it with WinRar (yes, it opens without errors – the “Test” function shows no errors, too) and just add one, random file inside, the game STARTS!

Seems like WinRar re-creates the zip file in a correct way, but I can’t make my launcher to do so.

Any ideas?

EDIT 1:

I’ve found another piece of code that is supposed to work:



      private static void zipDir(String zipFileName, String dir) throws Exception {
            File dirObj = new File(dir);
            ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName));
            System.out.println("Creating : " + zipFileName);
            addDir(dirObj, out);
            out.close();
          }

          static void addDir(File dirObj, ZipOutputStream out) throws IOException {
            File[] files = dirObj.listFiles();
            byte[] tmpBuf = new byte[1024];

            for (int i = 0; i < files.length; i++) {
              if (files[i].isDirectory()) {
                addDir(files[i], out);
                continue;
              }
              String fap = files[i].getAbsolutePath();
              String rel_path = fap.substring(fap.indexOf("wypakowane") + 11).replace("\\", "/");
              FileInputStream in = new FileInputStream(fap);
              System.out.println(" Adding: " + rel_path);
              out.putNextEntry(new ZipEntry(rel_path));
              int len;
              while ((len = in.read(tmpBuf)) > 0) {
                out.write(tmpBuf, 0, len);
              }
              out.closeEntry();
              in.close();
            }
          }

I think it creates the directories inside the ZIP file. Unfortunately, the game still doesn’t start…
(“wypakowane” is the directory that contains all the files I want to put into ZIP file.)

EDIT 2:

I just compared both archives – the one created by my java app and the one created by WinRar by adding random file. They are identical, have the same CRCs, same attributes and unpack correctly. But the game crashes with the first one, and runs smoothly with the second one. I’m running out of ideas. Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:49:47+00:00Added an answer on June 8, 2026 at 11:49 am

    You don’t appear to be making entries for the directories themselves, only for the files. While the directory entries can be reconstructed from the file paths, if you don’t put in the explicit entries a lot of software won’t work correctly with the file.

    A directory entry is just a regular entry where the path ends with “/”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.