forked from cwtch.im/ui
initialize cwtch dir before ACN tries to use
This commit is contained in:
parent
c6eb2189b0
commit
b3b7fb820e
25
main.go
25
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 {
|
||||
|
|
Loading…
Reference in New Issue