Skip to content

Commit

Permalink
v0.5 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
samoconnor committed Oct 27, 2016
1 parent 80c88f1 commit 2615271
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/InfoZIP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export open_zip, create_zip
using Compat.readstring
using Compat.read
using Compat.write
using Compat.UTF8String
if VERSION < v"0.5.0-dev+2228"
Base.read(cmd::Cmd) = readbytes(cmd)
end
Expand Down
5 changes: 2 additions & 3 deletions src/info_zip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ function Base.get(z::Archive, filename::AbstractString, default=nothing)
else
b = read(`unzip -qc $(z.filename) $filename`)
end
return isvalid(ASCIIString, b) ? ASCIIString(b) :
isvalid(UTF8String, b) ? UTF8String(b) : b
return isvalid(UTF8String, b) ? UTF8String(b) : b
end


Expand Down Expand Up @@ -129,7 +128,7 @@ end
# Read files from ZIP using iterator syntax.

Base.eltype(::Type{Archive}) =
Tuple{AbstractString,Union{ByteString,Vector{UInt8},AbstractString}}
Tuple{AbstractString,Union{UTF8String,Vector{UInt8},AbstractString}}

Base.keys(z::Archive) = z.keys
Base.length(z::Archive) = length(z.keys)
Expand Down
7 changes: 3 additions & 4 deletions src/zip_file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Archive(io::IO)
cache = Dict()
try
reader = ZipFile.Reader(io, false)
cache = Dict(f.name => "" for f in reader.files)
cache = Dict([Pair(f.name, "") for f in reader.files])
end
Archive(io, reader, nothing, cache, false)
end
Expand Down Expand Up @@ -138,7 +138,7 @@ end
# called to read the data from the archive.

Base.eltype(::Type{Archive}) =
Tuple{AbstractString,Union{ByteString,Vector{UInt8},AbstractString}}
Tuple{AbstractString,Union{UTF8String,Vector{UInt8},AbstractString}}

Base.keys(z::Archive) = keys(z.cache)
Base.length(z::Archive) = length(z.cache)
Expand All @@ -161,8 +161,7 @@ end

function readfile(io::ZipFile.ReadableFile)
b = read(io)
return isvalid(ASCIIString, b) ? ASCIIString(b) :
isvalid(UTF8String, b) ? UTF8String(b) : b
return isvalid(UTF8String, b) ? UTF8String(b) : b
end


Expand Down

0 comments on commit 2615271

Please sign in to comment.