mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-01-12 04:17:25 -05:00
mpq: implement GetFileList (#102)
This commit is contained in:
parent
5260fb7df7
commit
1511a897f9
11
mpq/MPQ.go
11
mpq/MPQ.go
@ -1,6 +1,7 @@
|
||||
package mpq
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"log"
|
||||
@ -286,6 +287,12 @@ func (v MPQ) GetFileList() ([]string, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Printf("File Contents:\n%s", strings.TrimRight(string(data), "\x00"))
|
||||
return []string{""}, nil
|
||||
raw := strings.TrimRight(string(data), "\x00")
|
||||
s := bufio.NewScanner(strings.NewReader(raw))
|
||||
var filePaths []string
|
||||
for s.Scan() {
|
||||
filePath := s.Text()
|
||||
filePaths = append(filePaths, filePath)
|
||||
}
|
||||
return filePaths, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user