Switch the lab reflector to jayReflector and harden local station use.
Build DJ1JAY’s fork with an optional Satellite/Trunk stub, allow -c/--config, open capture and playback as separate devices, and add a lab start helper. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func defaultConfigPath() (string, error) {
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(home, ".funknetz.json"), nil
|
||||
}
|
||||
|
||||
// resolveConfigPath picks the config file from -c / --config in args (no program name).
|
||||
// The default is ~/.funknetz.json. A relative path is resolved against the process CWD.
|
||||
func resolveConfigPath(args []string) (string, error) {
|
||||
fs := flag.NewFlagSet("funknetz", flag.ContinueOnError)
|
||||
fs.SetOutput(io.Discard)
|
||||
var config string
|
||||
fs.StringVar(&config, "config", "", "path to the station config file")
|
||||
fs.StringVar(&config, "c", "", "path to the station config file")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if config == "" {
|
||||
path, err := defaultConfigPath()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("config path: %w", err)
|
||||
}
|
||||
return path, nil
|
||||
}
|
||||
abs, err := filepath.Abs(config)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("config path: %w", err)
|
||||
}
|
||||
return abs, nil
|
||||
}
|
||||
Reference in New Issue
Block a user