fix mac issues
This commit is contained in:
13
config.go
13
config.go
@ -23,7 +23,10 @@ const (
|
||||
configName = "config.toml"
|
||||
)
|
||||
|
||||
var cfgPath string
|
||||
var (
|
||||
configRun = false
|
||||
cfgPath string
|
||||
)
|
||||
|
||||
func setupConfig(rerun bool) (*Config, error) {
|
||||
home, err := os.UserHomeDir()
|
||||
@ -40,6 +43,7 @@ func setupConfig(rerun bool) (*Config, error) {
|
||||
|
||||
_, statErr := os.Stat(cfgPath)
|
||||
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):")
|
||||
s, err := readLine()
|
||||
if err != nil {
|
||||
@ -81,7 +85,7 @@ func setupConfig(rerun bool) (*Config, error) {
|
||||
if s == "" {
|
||||
fmt.Printf("wine %s\n", newConfig.LaunchCmd)
|
||||
} 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)
|
||||
}
|
||||
@ -137,12 +141,11 @@ func input(prompt string) (string, error) {
|
||||
fmt.Println(prompt)
|
||||
fmt.Printf("> ")
|
||||
|
||||
var s string
|
||||
_, err := fmt.Scanf("%s", &s)
|
||||
s, err := readLine()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("unable to read input: %v", err)
|
||||
}
|
||||
return strings.TrimSpace(s), nil
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func readLine() (string, error) {
|
||||
|
9
main.go
9
main.go
@ -11,7 +11,6 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -70,6 +69,11 @@ func main() {
|
||||
fmt.Printf("%d files are already up to date\n\n", stats.current)
|
||||
}
|
||||
|
||||
if configRun {
|
||||
fmt.Println("Configuration complete!")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if updateOnlyFlag {
|
||||
os.Exit(0)
|
||||
}
|
||||
@ -81,9 +85,6 @@ func main() {
|
||||
|
||||
fmt.Println("Starting Epoch...")
|
||||
var cmd = strings.Split(config.LaunchCmd, " ")
|
||||
if runtime.GOOS == "darwin" {
|
||||
cmd = append([]string{"open"}, cmd...)
|
||||
}
|
||||
ex := exec.Command(cmd[0], cmd[1:]...)
|
||||
cmdStr := strings.Join(cmd, " ")
|
||||
if config.WinePrefix != "" {
|
||||
|
Reference in New Issue
Block a user