forked from gylang/aliyundriver-webdav-software-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.go
56 lines (52 loc) · 1.02 KB
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"aliyundriver-webdav/bussiness"
"aliyundriver-webdav/lifecycle"
"aliyundriver-webdav/m_container"
"aliyundriver-webdav/web"
"fyne.io/fyne/v2/app"
"log"
"os"
"time"
)
func main() {
lifecycle.InitBeforeConfig()
lifecycle.InitConfig()
args := os.Args
for _, v := range args {
println(v)
if "-server" == v {
for i := 0; i < 5; i++ {
if !lifecycle.WebdavRunningStatus() {
// 重试五次 可能因为网络问题没有成功
bussiness.RunWebDav()
if lifecycle.WebdavRunningStatus() {
return
}
time.Sleep(time.Second * 1)
}
}
return
}
}
if m_container.Config.WebAccess {
web.OpenWebServer()
} else {
func() {
defer func() {
// 启动失败异常处理
if p := recover(); p != nil {
// ui打不开 使用页面方式
log.Println(p)
log.Println("启动失败, 打开web页面")
web.OpenWebServer()
}
}()
a := app.New()
lifecycle.InitTheme(a)
m_container.MApp = a
go lifecycle.Process()
a.Run()
}()
}
}