simplify script loading
This commit is contained in:
parent
86ef3a0e82
commit
75ba1e8134
12
cmd/root.go
12
cmd/root.go
|
@ -18,7 +18,6 @@ package cmd
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
|
@ -41,17 +40,8 @@ func (s *script) load(path string) error {
|
|||
}
|
||||
defer f.Close()
|
||||
|
||||
data, err := io.ReadAll(f)
|
||||
if err != nil {
|
||||
err = json.NewDecoder(f).Decode(s)
|
||||
return err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(data, s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func handleWindowEvent(event *sdl.WindowEvent, m *milkDropWindow) {
|
||||
|
|
Loading…
Reference in New Issue