mirror of
https://github.com/pesde-pkg/tooling.git
synced 2025-04-19 19:33:56 +01:00
fix(lib): extracting wrong binary
This commit is contained in:
parent
f3f18089d7
commit
e223c58b2f
1 changed files with 16 additions and 6 deletions
|
@ -44,15 +44,26 @@ local extractBinary: {
|
||||||
Zip = function(compressed, binaryName, targetPlatform)
|
Zip = function(compressed, binaryName, targetPlatform)
|
||||||
local reader = unzip.load(compressed)
|
local reader = unzip.load(compressed)
|
||||||
|
|
||||||
local binaryEntry = reader:findEntry(binaryName)
|
local binaryContents: buffer?
|
||||||
local binaryContents = nil
|
|
||||||
|
|
||||||
|
local function extractEntry(entry: unzip.ZipEntry)
|
||||||
|
local contents = reader:extract(entry, { type = "binary" }) :: buffer
|
||||||
|
local executablePlatform = PlatformDescriptor.fromExecutable(contents)
|
||||||
|
|
||||||
|
if executablePlatform:isOk() and eq(executablePlatform:unwrap(), targetPlatform) then
|
||||||
|
binaryContents = contents
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local binaryEntry = reader:findEntry(binaryName)
|
||||||
if binaryEntry then
|
if binaryEntry then
|
||||||
binaryContents = reader:extract(binaryEntry, { type = "binary" }) :: buffer
|
extractEntry(binaryEntry)
|
||||||
else
|
end
|
||||||
|
|
||||||
|
if not binaryContents then
|
||||||
-- Walk through the entries to find an executable
|
-- Walk through the entries to find an executable
|
||||||
reader:walk(function(entry)
|
reader:walk(function(entry)
|
||||||
if binaryEntry then
|
if binaryContents then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,7 +75,6 @@ local extractBinary: {
|
||||||
local executablePlatform = PlatformDescriptor.fromExecutable(contents)
|
local executablePlatform = PlatformDescriptor.fromExecutable(contents)
|
||||||
|
|
||||||
if executablePlatform:isOk() and eq(executablePlatform:unwrap(), targetPlatform) then
|
if executablePlatform:isOk() and eq(executablePlatform:unwrap(), targetPlatform) then
|
||||||
binaryEntry = entry
|
|
||||||
binaryContents = contents
|
binaryContents = contents
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Reference in a new issue