diff --git a/extract.sh b/extract.sh new file mode 100755 index 0000000..210d714 --- /dev/null +++ b/extract.sh @@ -0,0 +1,2 @@ +#!/usr/bin/sh +go run ./tools/mpq/*.go --target="./asset" extract ./mpq/*.mpq diff --git a/tools/mpq/mpq.go b/tools/mpq/mpq.go index db2b2ef..4e1dc1e 100644 --- a/tools/mpq/mpq.go +++ b/tools/mpq/mpq.go @@ -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