internal/gamepaddb: use go:embed

Updates #1258
This commit is contained in:
Hajime Hoshi 2022-09-17 21:01:56 +09:00
parent 043397c20e
commit 129f201be4
2 changed files with 5 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -18,13 +18,12 @@
// //
// curl --location --remote-name https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt // curl --location --remote-name https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
//go:generate go run github.com/hajimehoshi/file2byteslice/cmd/file2byteslice@v1.0.0 -package gamepaddb -input=./gamecontrollerdb.txt -output=./gamecontrollerdb.txt.go -var=gamecontrollerdbTxt
package gamepaddb package gamepaddb
import ( import (
"bufio" "bufio"
"bytes" "bytes"
_ "embed"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"runtime" "runtime"
@ -33,6 +32,9 @@ import (
"sync" "sync"
) )
//go:embed gamecontrollerdb.txt
var gamecontrollerdb_txt []byte
type platform int type platform int
const ( const (
@ -92,7 +94,7 @@ var additionalGLFWGamepads = []byte(`
`) `)
func init() { func init() {
if err := Update(gamecontrollerdbTxt); err != nil { if err := Update(gamecontrollerdb_txt); err != nil {
panic(err) panic(err)
} }
if err := Update(additionalGLFWGamepads); err != nil { if err := Update(additionalGLFWGamepads); err != nil {