add extraction script, fix bug with having too many file handles opened

This commit is contained in:
Alex Yatskov 2018-12-15 18:00:49 -08:00
parent 43cef2c1d0
commit 5c89a5fa92
2 changed files with 5 additions and 1 deletions

2
extract.sh Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/sh
go run ./tools/mpq/*.go --target="./asset" extract ./mpq/*.mpq

View File

@ -76,11 +76,13 @@ func extract(mpqPath, filter, targetDir string) error {
if err != nil {
return err
}
defer sysFile.Close()
if _, err := io.Copy(sysFile, resFile); err != nil {
sysFile.Close()
return err
}
sysFile.Close()
}
return nil