Skip to content

Commit 65538b1

Browse files
committed
refactor comments
1 parent 88db8a7 commit 65538b1

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/library/ziputils.lua

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ Functions for unzipping files. (Future may include zipping as well.)
55
66
Dependencies:
77
8-
- MacOS users must have `unzip` and `gunzip`, but these are usually installed with the OS.
8+
- The Windows version uses `PowerShell`.
9+
- The macOS version uses `unzip` and `gunzip`.
10+
- In both cases the necessary tools are pre-installed with a typical installation of any version
11+
of the OS that supports 64-bit Finale.
912
1013
Pay careful attention to the comments about how strings are encoded. They are either encoded
1114
**platform** or **utf8**. On macOS, platform encoding is always utf8, but on Windows it can
1215
be any number of encodings depending on the locale settings and version of Windows. You can use
13-
`luaosutils.text` to convert them back and forth. Both `luaosutils.process.execute`
14-
requires platform encoding as do `lfs` and all built-in Lua `io` functions.
16+
`luaosutils.text` to convert them back and forth. (Use the `get_default_codepage` function to get
17+
the platform encoding.) The `luaosutils.process.execute` function requires platform encoding as do
18+
`lfs` and all built-in Lua `os` and `io` functions that take strings as input.
1519
1620
Note that many functions require later versions of RGP Lua that include `luaosutils`
1721
and/or `lfs`. But the these dependencies are embedded in each function so that any version
@@ -74,7 +78,6 @@ Returns a path that can be used as a temporary target for unzipping. The caller
7478
either as a file or a directory, because it is guaranteed not to exist when it is returned and it does
7579
not have a terminating path delimiter. Also returns a platform-dependent unzip command that can be
7680
passed to `luaosutils.process.execute` to unzip the input archive into the temporary name as a directory.
77-
The command may not be compatible with `os.execute`.
7881
7982
This function requires `luaosutils`.
8083
@@ -116,10 +119,9 @@ end
116119
--[[
117120
% calc_gunzip_command
118121
119-
Returns the platform-dependent command to gunzip a file. It can be passed
122+
Returns the platform-dependent command to gunzip a file to `stdout`. It can be passed
120123
to `luaosutils.process.execute`, which will then return the text directly.
121124
122-
123125
@ archive_path (string) platform-encoded path of source gzip archive.
124126
: (string) platform-encoded command string to execute.
125127
]]
@@ -142,7 +144,7 @@ end
142144
--[[
143145
% calc_is_gzip
144146
145-
Detects if an input buffer is a gzip archive. Sometimes, Finale gzips the internal EnigmaXML document.
147+
Detects if an input buffer is a gzip archive.
146148
147149
@ buffer (string) binary data to check if it is a gzip archive
148150
: (boolean) true if the buffer is a gzip archive
@@ -199,6 +201,11 @@ function ziputils.extract_enigmaxml(filepath)
199201
error(filepath .. " is not a .musx file.", 2)
200202
end
201203

204+
-- Steps to extract:
205+
-- Unzip the `.musx` (which is `.zip` in disguise)
206+
-- Run the `score.dat` file through `crypt_enigmaxml_buffer` to get a gzip archive of the EnigmaXML file.
207+
-- Gunzip the extracted EnigmaXML gzip archive into a string and return it.
208+
202209
local text = require("luaosutils").text
203210
local process = require("luaosutils").process
204211

0 commit comments

Comments
 (0)