diff --git a/tools/mpq/mpq.go b/tools/mpq/mpq.go index d5590b8..f9d3215 100644 --- a/tools/mpq/mpq.go +++ b/tools/mpq/mpq.go @@ -6,6 +6,7 @@ import ( "io" "os" "path" + "strings" "github.com/FooSoft/lazarus/formats/mpq" "github.com/bmatcuk/doublestar" @@ -37,7 +38,7 @@ func list(mpqPath, filter string) error { return nil } -func extract(mpqPath, filter, targetDir string) error { +func extract(mpqPath, filter, targetDir string, lowercase bool) error { arch, err := mpq.New(mpqPath) if err != nil { return err @@ -67,7 +68,7 @@ func extract(mpqPath, filter, targetDir string) error { } defer resFile.Close() - sysPath := path.Join(targetDir, resPath) + sysPath := path.Join(targetDir, strings.ToLower(resPath)) if err := os.MkdirAll(path.Dir(sysPath), 0777); err != nil { return err } @@ -92,6 +93,7 @@ func main() { var ( filter = flag.String("filter", "**", "wildcard file filter") targetDir = flag.String("target", ".", "target directory") + lowercase = flag.Bool("lowercase", true, "extract with lowercase paths") ) flag.Usage = func() { @@ -116,7 +118,7 @@ func main() { } case "extract": for i := 1; i < flag.NArg(); i++ { - if err := extract(flag.Arg(i), *filter, *targetDir); err != nil { + if err := extract(flag.Arg(i), *filter, *targetDir, *lowercase); err != nil { fmt.Fprintln(os.Stderr, err) } }