1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package fifi
- import "os"
- import "path/filepath"
- import al "gitlab.com/beoran/al5go/al"
- var DataPath string = ""
- func isDataPathOK(path string) bool {
- fn := filepath.Join(path, "eruta.conf")
- file, err := os.Open(fn)
- file.Close()
- return err == nil
- }
- func Initialize() bool {
- DataPath = os.Getenv("EBS_DATA")
- if isDataPathOK(DataPath) {
- return true
- }
- wd, err := os.Getwd()
- if err == nil {
- DataPath = filepath.Join(wd, "data")
- if isDataPathOK(DataPath) {
- return true
- }
- }
- return false
- }
- func Map(name string) string {
- return filepath.Join(DataPath, name)
- }
- func LoadBitmap(filename string) * al.Bitmap {
- return al.LoadBitmap(Map(filename))
- }
|