diff --git a/README.md b/README.md index 1aa723d6..8ea1d1c6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The -local and -debug flags are helpful when developing. ## Android -A arm-pie version of tor like [tor-0.3.5.7-armeabi-v7a](https://git.openprivacy.ca/openprivacy/buildfiles/src/master/tor/tor-0.3.5.7-armeabi-v7a.so) is required to be placed in `android/libs/armeabi-v7a` with the name `libtor.so` +We supply an arm-pie version of tor in `android/libs/armeabi-v7a` with the name `libtor.so` qtdeploy -docker build android adb install deploy/android/build-debug.apk diff --git a/linux/tor b/linux/tor index 6993fd44..5f3d6709 100755 Binary files a/linux/tor and b/linux/tor differ diff --git a/main.go b/main.go index bd627290..b3e75370 100644 --- a/main.go +++ b/main.go @@ -19,6 +19,7 @@ import ( "os/user" "path" "runtime" + "path/filepath" ) func init() { @@ -72,6 +73,21 @@ func main() { torpath := "tor" if runtime.GOOS == "android" { torpath = "/data/data/org.qtproject.example.go/lib/libtor.so" + } 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") + } + } else { + torpath = path.Join(dir, "deploy", "linux", "tor") + } + } else { + torpath = path.Join(dir, "tor") + } } acn, err := connectivity.StartTor(the.CwtchDir, torpath)