fix mac issues

This commit is contained in:
2025-07-12 05:51:07 -07:00
parent afb8457489
commit 2cdeeef5b4
2 changed files with 13 additions and 9 deletions

View File

@ -23,7 +23,10 @@ const (
configName = "config.toml" configName = "config.toml"
) )
var cfgPath string var (
configRun = false
cfgPath string
)
func setupConfig(rerun bool) (*Config, error) { func setupConfig(rerun bool) (*Config, error) {
home, err := os.UserHomeDir() home, err := os.UserHomeDir()
@ -40,6 +43,7 @@ func setupConfig(rerun bool) (*Config, error) {
_, statErr := os.Stat(cfgPath) _, statErr := os.Stat(cfgPath)
if rerun || os.IsNotExist(statErr) { if rerun || os.IsNotExist(statErr) {
configRun = true
fmt.Println("Enter the path to your Wow directory below. Use the full path without shortcuts like '~' (ex: /home/user/epoch):") fmt.Println("Enter the path to your Wow directory below. Use the full path without shortcuts like '~' (ex: /home/user/epoch):")
s, err := readLine() s, err := readLine()
if err != nil { if err != nil {
@ -81,7 +85,7 @@ func setupConfig(rerun bool) (*Config, error) {
if s == "" { if s == "" {
fmt.Printf("wine %s\n", newConfig.LaunchCmd) fmt.Printf("wine %s\n", newConfig.LaunchCmd)
} else { } else {
fmt.Printf("WINEPREFIX=%s wine %s\n", newConfig.WinePrefix, newConfig.LaunchCmd) fmt.Printf("WINEPREFIX=%s %s\n", newConfig.WinePrefix, newConfig.LaunchCmd)
} }
fmt.Printf("Modify the configuration file at %s if you need to customize it\n\n", cfgPath) fmt.Printf("Modify the configuration file at %s if you need to customize it\n\n", cfgPath)
} }
@ -137,12 +141,11 @@ func input(prompt string) (string, error) {
fmt.Println(prompt) fmt.Println(prompt)
fmt.Printf("> ") fmt.Printf("> ")
var s string s, err := readLine()
_, err := fmt.Scanf("%s", &s)
if err != nil { if err != nil {
return "", fmt.Errorf("unable to read input: %v", err) return "", fmt.Errorf("unable to read input: %v", err)
} }
return strings.TrimSpace(s), nil return s, nil
} }
func readLine() (string, error) { func readLine() (string, error) {

View File

@ -11,7 +11,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
) )
@ -70,6 +69,11 @@ func main() {
fmt.Printf("%d files are already up to date\n\n", stats.current) fmt.Printf("%d files are already up to date\n\n", stats.current)
} }
if configRun {
fmt.Println("Configuration complete!")
os.Exit(0)
}
if updateOnlyFlag { if updateOnlyFlag {
os.Exit(0) os.Exit(0)
} }
@ -81,9 +85,6 @@ func main() {
fmt.Println("Starting Epoch...") fmt.Println("Starting Epoch...")
var cmd = strings.Split(config.LaunchCmd, " ") var cmd = strings.Split(config.LaunchCmd, " ")
if runtime.GOOS == "darwin" {
cmd = append([]string{"open"}, cmd...)
}
ex := exec.Command(cmd[0], cmd[1:]...) ex := exec.Command(cmd[0], cmd[1:]...)
cmdStr := strings.Join(cmd, " ") cmdStr := strings.Join(cmd, " ")
if config.WinePrefix != "" { if config.WinePrefix != "" {