forked from cwtch.im/ui
Merge branch 'cwthdir' of dan/ui into master
This commit is contained in:
commit
469a36b1f6
25
main.go
25
main.go
|
@ -7,7 +7,6 @@ import (
|
||||||
"cwtch.im/ui/go/gobjects"
|
"cwtch.im/ui/go/gobjects"
|
||||||
"cwtch.im/ui/go/gothings"
|
"cwtch.im/ui/go/gothings"
|
||||||
"cwtch.im/ui/go/the"
|
"cwtch.im/ui/go/the"
|
||||||
"fmt"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||||
"github.com/therecipe/qt/gui"
|
"github.com/therecipe/qt/gui"
|
||||||
|
@ -16,10 +15,11 @@ import (
|
||||||
"github.com/therecipe/qt/qml"
|
"github.com/therecipe/qt/qml"
|
||||||
"github.com/therecipe/qt/quickcontrols2"
|
"github.com/therecipe/qt/quickcontrols2"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"os/user"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -70,6 +70,17 @@ func main() {
|
||||||
engine.RootContext().SetContextProperty("gcd", gcd)
|
engine.RootContext().SetContextProperty("gcd", gcd)
|
||||||
engine.Load(qmlSource)
|
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"
|
torpath := "tor"
|
||||||
if runtime.GOOS == "android" {
|
if runtime.GOOS == "android" {
|
||||||
torpath = "/data/data/org.qtproject.example.go/lib/libtor.so"
|
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
|
// for now, it loads a single peer and fills the ui with its data
|
||||||
func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) {
|
func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) {
|
||||||
var err error
|
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")
|
/*_, err := app2.NewApp(dirname, "/data/data/org.qtproject.example.go/lib/libtor.so")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue