Results 1 to 7 of 7

Thread: paszlib on Linux 64-bit creates empty archive

  1. #1

    paszlib on Linux 64-bit creates empty archive

    I'm working on a game where I use paszlib to compress the save files. This works fine on the Windows and Linux setups I've tested it on myself, but a user reported that the game crashed whenever he tried to load a saved file. Some testing revealed that the archives created on his system (Ubuntu 12.04 64-bit) with paszlib are empty -- that is, the zip file is only 122 bytes (which I assume is header information), and when it's uncompressed, the resulting file is 0 bytes.

    Here's the relevant code:

    Code:
    PROCEDURE EncodeSaveFile(Const FileName : String);
    VAR Zip : TZipper;
    BEGIN
       Zip := TZipper.Create;
       Zip.FileName := 'saves/' + FileName + '.zip';
       Zip.Entries.AddFileEntry('saves/' + FileName + '.dat', 'saves/' + FileName + '.dat');
       Zip.ZipAllFiles;
       Zip.Free;
    END;
    Some game data files (for example level and map files) are already compressed, and these seem to decompress fine, as the user has no problem playing a level. I'm completely stumped as to what's causing the issue with compression but not decompression. Any ideas?
    Laserbrain Studios - Currently developing Hidden Asset!
    Ascii Sector
    - Real-time roguelike in space!

  2. #2
    PGDCE Developer de_jean_7777's Avatar
    Join Date
    Nov 2006
    Location
    Bosnia and Herzegovina (Herzegovina)
    Posts
    243
    Seems ok. Make sure that AddFileEntry is receiving correct filenames. Check what ('saves/' + FileName + '.dat') gives you and if it matches to a save path/filename. It could be possible that TZipper is not able to read the save file for some reason (like invalid filename).
    In defeat we learn.

  3. #3
    Yeah, it does seem like TZipper can't read the save file. I've sent an executable that tests the path/file name to the user with the issue.
    Laserbrain Studios - Currently developing Hidden Asset!
    Ascii Sector
    - Real-time roguelike in space!

  4. #4
    The report back is that my code can definitely access the .dat file with FileExists(), so that's not it.
    Laserbrain Studios - Currently developing Hidden Asset!
    Ascii Sector
    - Real-time roguelike in space!

  5. #5
    Man, this sure is weird. His system can compress a file that already exists, but if the code has to create the file first, it doesn't work.

    Code:
    PROGRAM compressiontest;
    
    USES sdl, zipper;
    
    VAR Zip : TZipper;
        FileName : String;
        SaveFile : Text;
        I : Byte;
    
    BEGIN
       FileName := '1';
       Assign(SaveFile, 'saves/' + FileName + '.dat');
       Rewrite(SaveFile);
       FOR I := 1 TO 200 DO Writeln(SaveFile, 'HELLO WORLD!');
       Flush(SaveFile);
       Close(SaveFile);
    
       sdl_delay(500);
    
       Zip := TZipper.Create;
       Zip.FileName := 'saves/' + FileName + '.zip';
       Zip.Entries.AddFileEntry('saves/' + FileName + '.dat', 'saves/' + FileName + '.dat');
       Zip.ZipAllFiles;
       Zip.Free;
    
       Assign(SaveFile, 'saves/' + FileName + '.dat');
       Erase(SaveFile);
    END.
    The above code creates saves/1.zip and the zip archive shows the correct size of 1.dat inside it. But unzipping that file shows that its size is 0.
    Last edited by Christian Knudsen; 05-10-2012 at 07:18 PM. Reason: 'compress a file' not 'compile'
    Laserbrain Studios - Currently developing Hidden Asset!
    Ascii Sector
    - Real-time roguelike in space!

  6. #6
    Haven't used TZipper, but can point some things:
    - Linux has a case sensitive file system, double check what you save and what you load.
    - Be aware that you may have a restricted permission mask over file attributes, you may be expecting -rw-rw-rw- and you are getting anything else.
    - Your saving path can be different than your loading path.

  7. #7
    So updating the compiler from 2.4.0 to 2.6.0 and also not compiling with any debug information seems to have fixed the issue. Weird.
    Laserbrain Studios - Currently developing Hidden Asset!
    Ascii Sector
    - Real-time roguelike in space!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comodo SSL