From 3e678b322a625d5a45352da233850e730630ceb6 Mon Sep 17 00:00:00 2001 From: Sam O'Connor Date: Mon, 20 Jun 2016 10:27:34 +1000 Subject: [PATCH] add ENV["HAVE_INFOZIP"] option to support userimg.jl build --- src/InfoZIP.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/InfoZIP.jl b/src/InfoZIP.jl index c588e7b..7cb8c59 100644 --- a/src/InfoZIP.jl +++ b/src/InfoZIP.jl @@ -13,18 +13,20 @@ Base.read(cmd::Cmd) = readbytes(cmd) end -have_infozip = false -try - if ismatch(r"^UnZip.*by Info-ZIP.", readstring(`unzip`)) - have_infozip = true +have_infozip() = haskey(ENV, "HAVE_INFOZIP") || try + ismatch(r"^UnZip.*by Info-ZIP.", readstring(`unzip`)) +catch ex + if isa(ex, Base.UVError) && ex.code == Base.UV_ENOENT + return false end -catch + rethrow(ex) end -if have_infozip +if have_infozip() include("info_zip.jl") else + warn("InfoZIP falling back to ZipFile.jl backend!") include("zip_file.jl") end