2021-10-04 21:56:44 +02:00
|
|
|
package main
|
|
|
|
|
2022-03-07 22:18:29 +01:00
|
|
|
import (
|
2022-09-02 13:22:05 +02:00
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"path"
|
|
|
|
|
2022-03-07 22:18:29 +01:00
|
|
|
"fyne.io/fyne/v2/app"
|
2022-03-07 23:24:02 +01:00
|
|
|
|
|
|
|
"github.com/qwc/backive"
|
|
|
|
backiveui "github.com/qwc/backive/ui"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2022-08-14 21:33:38 +02:00
|
|
|
config backive.Configuration
|
2022-03-07 22:18:29 +01:00
|
|
|
)
|
2021-10-04 21:56:44 +02:00
|
|
|
|
2022-09-02 13:22:05 +02:00
|
|
|
func setupLogging() {
|
|
|
|
apphomedir, _ := os.UserHomeDir()
|
|
|
|
apphomedir = path.Join(apphomedir, ".config", "backive")
|
|
|
|
logname := path.Join(apphomedir, "backiveui.log")
|
|
|
|
logdir, _ := path.Split(logname)
|
|
|
|
backive.CreateDirectoryIfNotExists(logdir)
|
|
|
|
logfile, err := os.OpenFile(logname, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
panic("no logfile no info")
|
|
|
|
}
|
|
|
|
log.SetOutput(logfile)
|
|
|
|
log.Println("Logging initialized")
|
|
|
|
}
|
|
|
|
|
2021-10-04 21:56:44 +02:00
|
|
|
func main() {
|
2022-03-07 23:24:02 +01:00
|
|
|
|
|
|
|
config.Load()
|
2022-09-02 13:22:05 +02:00
|
|
|
setupLogging()
|
2022-03-21 22:41:24 +01:00
|
|
|
app := app.NewWithID("Backive UI")
|
2022-08-14 21:33:38 +02:00
|
|
|
backiveui.Init(app, nil, config)
|
2022-04-18 22:13:06 +02:00
|
|
|
app.Run()
|
2021-10-04 21:56:44 +02:00
|
|
|
}
|