downloader: unzip to dist/ directory

This commit is contained in:
Araq
2017-01-23 00:45:29 +01:00
parent 26a8364ed7
commit 65dda79335

View File

@@ -27,8 +27,13 @@ proc download(pkg: string; c: Controls) {.async.} =
# XXX make this async somehow:
writeFile(z, contents)
c.bar.value = 100
if os.execShellCmd("7zG x " & z) != 0:
c.lab.text = "Unpacking failed: " & z
let olddir = getCurrentDir()
try:
setCurrentDir(olddir / "dist")
if os.execShellCmd("bin\\7zG.exe x " & pkg & ".zip") != 0:
c.lab.text = "Unpacking failed: " & z
finally:
setCurrentdir(olddir)
when false:
var a: ZipArchive