Skip to content

Commit

Permalink
优化macOS下更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Feb 28, 2022
1 parent 74e8ea7 commit 6ded089
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"time"
Expand Down Expand Up @@ -85,6 +86,13 @@ func checkEnv() {
if ci = checkCfw(); ci == nil {
exit("请先运行Clash for Windows再来更新!")
}
if runtime.GOOS == "darwin" {
if exePath, err := os.Executable(); err != nil {
exit(err.Error())
} else {
os.Chdir(filepath.Dir(exePath))
}
}
proxyUrl := fmt.Sprintf("127.0.0.1:%s", ci.mixPort)
os.Setenv("HTTP_PROXY", proxyUrl)
os.Setenv("HTTPS_PROXY", proxyUrl)
Expand Down

0 comments on commit 6ded089

Please sign in to comment.