1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-07-03 11:55:22 +00:00

mpq: implement GetFileList (#102)

This commit is contained in:
Robin Eklind 2019-11-07 16:35:25 -06:00 committed by Tim Sarbin
parent 5260fb7df7
commit 1511a897f9

View File

@ -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
}