Merge branch 'cwthdir' of dan/ui into master

This commit is contained in:
Sarah Jamie Lewis 2019-02-14 19:20:39 +00:00 committed by Gogs
commit 469a36b1f6
1 changed files with 13 additions and 12 deletions

25
main.go
View File

@ -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 {