2
0
mirror of https://github.com/OrbTools/OrbCommon synced 2024-11-18 03:25:32 +00:00

naming conflicts

This commit is contained in:
Minizbot2012 2021-07-28 02:19:02 -04:00
parent 3f13b861bc
commit b38c22300c
No known key found for this signature in database
GPG Key ID: 977C8ADE12361917
2 changed files with 9 additions and 9 deletions

View File

@ -13,14 +13,14 @@ import (
)
//go:embed json/*
var data embed.FS
var df embed.FS
func init() {
DeviceTypes = make(map[string]*DeviceDef)
files, _ := fs.ReadDir(data, "json")
files, _ := fs.ReadDir(df, "json")
for _, file := range files {
dev := new(DeviceDef)
data, _ := data.ReadFile("json/" + file.Name())
data, _ := df.ReadFile("json/" + file.Name())
json.Unmarshal(data, dev)
DeviceTypes[strings.Split(file.Name(), ".")[0]] = dev
}

View File

@ -4,7 +4,7 @@ package devices
import (
"embed"
"github.com/davecgh/go-xdr/xdr2"
xdr "github.com/davecgh/go-xdr/xdr2"
"io"
"io/fs"
"os"
@ -12,20 +12,20 @@ import (
)
//go:embed xdr/*
var data embed.FS
var df embed.FS
func init() {
DeviceTypes = make(map[string]*DeviceDef)
files, _ := fs.ReadDir(data, "xdr")
files, _ := fs.ReadDir(df, "xdr")
for _, file := range files {
dev := new(DeviceDef)
data, _ := jsons.ReadFile("xdr/" + file.Name())
xdr2.Unmarshal(data, dev)
data, _ := df.ReadFile("xdr/" + file.Name())
xdr.Unmarshal(data, dev)
DeviceTypes[strings.Split(file.Name(), ".")[0]] = dev
}
}
//LoadKM Load Orbmap KM structure
//LoadKeymap Load Orbmap KM structure
func LoadKeymap(file string, dev *DeviceDef) *KeyMap {
mapped := new(KeyMap)
of, _ := os.Open(file)