start tor on windows properly

This commit is contained in:
Dan Ballard 2019-08-09 17:31:22 -07:00
parent 6de3805ecf
commit c6ed152809
1 changed files with 8 additions and 5 deletions

13
main.go
View File

@ -193,15 +193,18 @@ func loadACN() {
torpath := "tor"
if runtime.GOOS == "android" {
torpath = path.Join(androidBaseDir, "lib/libtor.so")
} else if runtime.GOOS == "windows" {
ex, err := os.Executable()
if err != nil {
ex = ""
}
exPath := filepath.Dir(ex)
torpath = path.Join(exPath, "tor-0.3.5.7", "Tor", "tor.exe")
} else {
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
if _, err := os.Stat(path.Join(dir, "tor")); os.IsNotExist(err) {
if _, err := os.Stat(path.Join(dir, "deploy", "linux", "tor")); os.IsNotExist(err) {
if _, err := os.Stat(path.Join(dir, "deploy", "windows", "tor")); os.IsNotExist(err) {
log.Warnln("Cannot find bundled Tor")
} else {
torpath = path.Join(dir, "deploy", "windows", "tor")
}
log.Warnln("Cannot find bundled Tor")
} else {
torpath = path.Join(dir, "deploy", "linux", "tor")
}