Resolve relative ssh dir during config load on iOS

This commit is contained in:
2026-02-07 19:36:46 -05:00
parent 5b591e35d8
commit 25edd344c8
4 changed files with 52 additions and 14 deletions
+24
View File
@@ -0,0 +1,24 @@
//go:build !ios
package config
import (
"encoding/json"
"errors"
"os"
"github.com/rwinkhart/libmutton/global"
)
// Load loads libmuttoncfg.json and returns the configuration.
func Load() (*CfgT, error) {
cfgBytes, err := os.ReadFile(global.CfgPath)
if err != nil {
return nil, errors.New("unable to load libmuttoncfg.json: " + err.Error())
}
var cfg CfgT
if err = json.Unmarshal(cfgBytes, &cfg); err != nil {
return nil, errors.New("unable to unmarshal libmuttoncfg.json: " + err.Error())
}
return &cfg, nil
}