add force lowercase mode for export
This commit is contained in:
parent
9e931a409a
commit
d136631eb7
@ -6,6 +6,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/FooSoft/lazarus/formats/mpq"
|
"github.com/FooSoft/lazarus/formats/mpq"
|
||||||
"github.com/bmatcuk/doublestar"
|
"github.com/bmatcuk/doublestar"
|
||||||
@ -37,7 +38,7 @@ func list(mpqPath, filter string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func extract(mpqPath, filter, targetDir string) error {
|
func extract(mpqPath, filter, targetDir string, lowercase bool) error {
|
||||||
arch, err := mpq.New(mpqPath)
|
arch, err := mpq.New(mpqPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -67,7 +68,7 @@ func extract(mpqPath, filter, targetDir string) error {
|
|||||||
}
|
}
|
||||||
defer resFile.Close()
|
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 {
|
if err := os.MkdirAll(path.Dir(sysPath), 0777); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -92,6 +93,7 @@ func main() {
|
|||||||
var (
|
var (
|
||||||
filter = flag.String("filter", "**", "wildcard file filter")
|
filter = flag.String("filter", "**", "wildcard file filter")
|
||||||
targetDir = flag.String("target", ".", "target directory")
|
targetDir = flag.String("target", ".", "target directory")
|
||||||
|
lowercase = flag.Bool("lowercase", true, "extract with lowercase paths")
|
||||||
)
|
)
|
||||||
|
|
||||||
flag.Usage = func() {
|
flag.Usage = func() {
|
||||||
@ -116,7 +118,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
case "extract":
|
case "extract":
|
||||||
for i := 1; i < flag.NArg(); i++ {
|
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)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user