Fixed an error when building an assembly in fyne-cross.

This commit is contained in:
Leonid Nikitin 2024-02-17 20:06:09 +06:00
parent 240ae7aa96
commit d0539f5e90
Signed by: kor-elf
GPG Key ID: 3C0F720C170F6E1D

38
main.go
View File

@ -18,7 +18,7 @@ import (
"os" "os"
) )
var app kernel.AppContract var application kernel.AppContract
var ffPathUtilities *kernel.FFPathUtilities var ffPathUtilities *kernel.FFPathUtilities
func init() { func init() {
@ -41,7 +41,7 @@ func init() {
localizerService.AddListener(layoutLocalizerListener) localizerService.AddListener(layoutLocalizerListener)
queue := kernel.NewQueueList() queue := kernel.NewQueueList()
app = kernel.NewApp( application = kernel.NewApp(
appMetadata, appMetadata,
localizerService, localizerService,
queue, queue,
@ -51,17 +51,17 @@ func init() {
} }
func main() { func main() {
errorView := error2.NewView(app) errorView := error2.NewView(application)
if canCreateFile("data/database") != true { if canCreateFile("data/database") != true {
errorView.PanicErrorWriteDirectoryData() errorView.PanicErrorWriteDirectoryData()
app.GetWindow().ShowAndRun() application.GetWindow().ShowAndRun()
return return
} }
db, err := gorm.Open(sqlite.Open("data/database"), &gorm.Config{}) db, err := gorm.Open(sqlite.Open("data/database"), &gorm.Config{})
if err != nil { if err != nil {
errorView.PanicError(err) errorView.PanicError(err)
app.GetWindow().ShowAndRun() application.GetWindow().ShowAndRun()
return return
} }
@ -70,7 +70,7 @@ func main() {
err = migration.Run(db) err = migration.Run(db)
if err != nil { if err != nil {
errorView.PanicError(err) errorView.PanicError(err)
app.GetWindow().ShowAndRun() application.GetWindow().ShowAndRun()
return return
} }
@ -79,7 +79,7 @@ func main() {
pathFFmpeg, err := convertorRepository.GetPathFfmpeg() pathFFmpeg, err := convertorRepository.GetPathFfmpeg()
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) == false { if err != nil && errors.Is(err, gorm.ErrRecordNotFound) == false {
errorView.PanicError(err) errorView.PanicError(err)
app.GetWindow().ShowAndRun() application.GetWindow().ShowAndRun()
return return
} }
ffPathUtilities.FFmpeg = pathFFmpeg ffPathUtilities.FFmpeg = pathFFmpeg
@ -87,29 +87,29 @@ func main() {
pathFFprobe, err := convertorRepository.GetPathFfprobe() pathFFprobe, err := convertorRepository.GetPathFfprobe()
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) == false { if err != nil && errors.Is(err, gorm.ErrRecordNotFound) == false {
errorView.PanicError(err) errorView.PanicError(err)
app.GetWindow().ShowAndRun() application.GetWindow().ShowAndRun()
return return
} }
ffPathUtilities.FFprobe = pathFFprobe ffPathUtilities.FFprobe = pathFFprobe
app.RunConvertor() application.RunConvertor()
defer app.AfterClosing() defer application.AfterClosing()
localizerView := localizer.NewView(app) localizerView := localizer.NewView(application)
convertorView := convertor.NewView(app) convertorView := convertor.NewView(application)
convertorHandler := handler.NewConvertorHandler(app, convertorView, convertorRepository) convertorHandler := handler.NewConvertorHandler(application, convertorView, convertorRepository)
localizerRepository := localizer.NewRepository(settingRepository) localizerRepository := localizer.NewRepository(settingRepository)
menuView := menu.NewView(app) menuView := menu.NewView(application)
localizerListener := handler.NewLocalizerListener() localizerListener := handler.NewLocalizerListener()
app.GetLocalizerService().AddListener(localizerListener) application.GetLocalizerService().AddListener(localizerListener)
mainMenu := handler.NewMenuHandler(app, convertorHandler, menuView, localizerView, localizerRepository, localizerListener) mainMenu := handler.NewMenuHandler(application, convertorHandler, menuView, localizerView, localizerRepository, localizerListener)
mainHandler := handler.NewMainHandler(app, convertorHandler, mainMenu, localizerRepository) mainHandler := handler.NewMainHandler(application, convertorHandler, mainMenu, localizerRepository)
mainHandler.Start() mainHandler.Start()
app.GetWindow().SetMainMenu(mainMenu.GetMainMenu()) application.GetWindow().SetMainMenu(mainMenu.GetMainMenu())
app.GetWindow().ShowAndRun() application.GetWindow().ShowAndRun()
} }
func appCloseWithDb(db *gorm.DB) { func appCloseWithDb(db *gorm.DB) {