Files
cloudsave/cmd/gui/main.go
Aurélie DELHAIE b36142c309
Some checks failed
CloudSave/pipeline/head There was a failure building this commit
wip
2025-09-12 19:06:52 +02:00

47 lines
958 B
Go

package main
import (
"cloudsave/cmd/gui/window/mainwindow"
"cloudsave/pkg/data"
"cloudsave/pkg/repository"
"fmt"
"os"
"path/filepath"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/dialog"
)
func main() {
a := app.NewWithID("com.thelilfrog.CloudSave")
roaming, err := os.UserConfigDir()
if err != nil {
panic("failed to get user config path: " + err.Error())
}
datastorepath := filepath.Join(roaming, "cloudsave", "data")
err = os.MkdirAll(datastorepath, 0740)
if err != nil {
d := dialog.NewError(fmt.Errorf("cannot make the datastore: %w", err), a.NewWindow("CloudSave"))
d.Show()
d.SetOnClosed(func() {
os.Exit(1)
})
}
repo, err := repository.NewLazyRepository(datastorepath)
if err != nil {
d := dialog.NewError(fmt.Errorf("cannot make the datastore: %w", err), a.NewWindow("CloudSave"))
d.Show()
d.SetOnClosed(func() {
os.Exit(1)
})
}
s := data.NewService(repo)
w := mainwindow.Make(a, s)
w.ShowAndRun()
}