diff --git a/main.go b/main.go index b3e7537..844f741 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,6 @@ import ( "cwtch.im/ui/go/gobjects" "cwtch.im/ui/go/gothings" "cwtch.im/ui/go/the" - "fmt" "git.openprivacy.ca/openprivacy/libricochet-go/connectivity" "git.openprivacy.ca/openprivacy/libricochet-go/log" "github.com/therecipe/qt/gui" @@ -16,10 +15,11 @@ import ( "github.com/therecipe/qt/qml" "github.com/therecipe/qt/quickcontrols2" "os" - "os/user" "path" "runtime" "path/filepath" + "os/user" + "fmt" ) func init() { @@ -70,6 +70,17 @@ func main() { engine.RootContext().SetContextProperty("gcd", gcd) engine.Load(qmlSource) + if os.Getenv("CWTCH_FOLDER") != "" { + the.CwtchDir = os.Getenv("CWTCH_FOLDER") + } else { + usr, err := user.Current() + if err != nil { + fmt.Printf("\nerror: could not load current user: %v\n", err) + os.Exit(1) + } + the.CwtchDir = path.Join(usr.HomeDir, ".cwtch") + } + torpath := "tor" if runtime.GOOS == "android" { torpath = "/data/data/org.qtproject.example.go/lib/libtor.so" @@ -128,16 +139,6 @@ func main() { // for now, it loads a single peer and fills the ui with its data func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) { var err error - if os.Getenv("CWTCH_FOLDER") != "" { - the.CwtchDir = os.Getenv("CWTCH_FOLDER") - } else { - usr, err := user.Current() - if err != nil { - fmt.Printf("\nerror: could not load current user: %v\n", err) - os.Exit(1) - } - the.CwtchDir = path.Join(usr.HomeDir, ".cwtch") - } /*_, err := app2.NewApp(dirname, "/data/data/org.qtproject.example.go/lib/libtor.so") if err != nil {