Charles B
Charles B

Reputation: 71

How to get revZip to create a file and add an item to the archive?

Here's the simple handler I'm using to test/learn the revZip library. The fld "XML" contains XML as text. I just can't see the error... Any ideas?

command SaveIssue
    put fld "XML" into tXML
    ask file "Save as:" with "NewIssue.zip" as sheet; CheckResult the result
    put it into tPath
    revZipOpenArchive tPath, "write"; CheckResult the result
    revZipAddItemWithData tPath, "issue.xml", tXML; CheckResult the result
    revZipCloseArchive tPath; CheckResult the result
end SaveIssue

command CheckResult tResult
   if tResult is not empty then
      if tResult is "Cancel" then exit to top
      answer "Error:" && tResult
      exit to top
   end if
end CheckResult

Upvotes: 0

Views: 89

Answers (1)

Charles B
Charles B

Reputation: 71

I found the answer in an old forum post. The revZip external requires quotes around variable names. Kind of weird, but this change to this line fixes it:

revZipAddItemWithData tPath, "issue.xml", "tXML"

Upvotes: 1

Related Questions