From 0653430164b3aa6ddd78c0f296bde97511cb9c61 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 19 Feb 2019 13:32:52 -0800 Subject: [PATCH] use full path for android to cwtch dir --- main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 844f741..0c5c57e 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,8 @@ import ( "fmt" ) +const androidBaseDir = "/data/data/org.qtproject.example.go/" + func init() { // make go-defined types available in qml gothings.GrandCentralDispatcher_QmlRegisterType2("CustomQmlTypes", 1, 0, "GrandCentralDispatcher") @@ -35,7 +37,6 @@ func main() { log.SetLevel(log.LevelInfo) } - // our globals gcd := gothings.NewGrandCentralDispatcher(nil) gcd.UIState = gothings.NewUIState(gcd) @@ -53,7 +54,6 @@ func main() { qmlSource = core.NewQUrl3("qrc:/qml/main.qml", 0) } - app := gui.NewQGuiApplication(len(os.Args), os.Args) app.SetWindowIcon(gui.NewQIcon5(":/qml/images/cwtch-icon.png")) @@ -72,7 +72,9 @@ func main() { if os.Getenv("CWTCH_FOLDER") != "" { the.CwtchDir = os.Getenv("CWTCH_FOLDER") - } else { + } else if runtime.GOOS == "android" { + the.CwtchDir = path.Join(androidBaseDir, "files") + } else { usr, err := user.Current() if err != nil { fmt.Printf("\nerror: could not load current user: %v\n", err) @@ -83,7 +85,7 @@ func main() { torpath := "tor" if runtime.GOOS == "android" { - torpath = "/data/data/org.qtproject.example.go/lib/libtor.so" + torpath = path.Join(androidBaseDir, "lib/libtor.so") } else { dir, _ := filepath.Abs(filepath.Dir(os.Args[0])) if _, err := os.Stat(path.Join(dir, "tor")); os.IsNotExist(err) {