Better download detection

This commit is contained in:
Elliot Saba 2018-03-06 08:29:44 -08:00
parent 19f691d342
commit 6445295318

View File

@ -5,13 +5,18 @@ export cmudict
using ..Data: deps
const version = "0.7b"
const cache_prefix = "https://cache.julialang.org"
function load()
isdir(deps("cmudict")) && return
suffixes = ["", ".phones", ".symbols"]
if isdir(deps("cmudict"))
if all(isfile.(["cmudict$x" for x in suffixes]))
return
end
end
mkpath(deps("cmudict"))
for x in ["", ".phones", ".symbols"]
download("https://cache.julialang.org/http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-$version$x",
deps("cmudict", "cmudict$x"))
for x in suffixes
download("$cache_prefix/http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-$version$x", deps("cmudict", "cmudict$x"))
end
end