Archived Forum Post

Index of archived forum posts

Question:

AppendFiles is not invoking?

Jun 06 '17 at 06:27

Hi, I am using the library on a Ruby on Rails project. I used basically the same code as in the example "(Ruby) Create a WinZip compatible AES Encrypted Zip".

Here is the code:

  zip = Chilkat::CkZip.new()
  success = zip.UnlockComponent("Anything for 30-day trial")
    if (success != true)
    @message.encryption_description = zip.lastErrorText() + "\n";
    exit
  else
    @message.encryption_description = "zero sucess!"
  end

  success1 = zip.NewZip("app/encryptedzipfiles/aes.zip")
  if (success1 != true)
    @message.encryption_description = zip.lastErrorText() + "\n";
    exit
  else
    @message.encryption_description = "first success!"
  end

  zip.put_Encryption(4)
  zip.put_EncryptKeyLength(128)
  zip.put_EncryptPassword("password")

  success2 = zip.AppendFiles("app/contents/*", true)
  if (success2 != true)
    @message.encryption_description = zip.lastErrorText() + "\n";
    exit
  else
    @message.encryption_description = "second sucess!"
  end

  success3 = zip.WriteZipAndClose()
  if (success3 != true)
    @message.encryption_description = zip.lastErrorText() + "\n";
    exit
  else
    @message.encryption_description = "third sucess!"
  end

However, after this method is called and I examine the aes.zip it has only 22 bytes, and no files in it to be unzipped.
There are three files under "app/contents/"

Could you provide some information about what could be wrong with this?

Thanks!!!


Answer

Make sure the current working directory of your running program (i.e. the application process) is actually where you intended it to be (in the directory where "apps" is a sub-directory.


Answer

Hi Chilkat,

Thanks for your response!! However, I checked path for app/contents and app/encryptedzipfiles and I think they are working fine. I added "zip.put_DebugLogFilePath("app/encryptedzipfiles/zip.log");" above "success1 = zip.NewZip("app/encryptedzipfiles/aes.zip")" to see the Chilkat logs, and the log files shows "NewZip", "AppendFiles" and "WriteZipAndClose" are all success. I am assuming that if the path cannot open a folder, it would fail the AppendFiles or NewZip, and the log file would also reflected those.

Is there anywhere else I can check?

THanks!!!!


Answer

I am having the same issue from last month can you please let me know how you able to solve this. ?