pikapika/go/main/config/common.go

30 lines
973 B
Go
Raw Normal View History

2021-09-29 23:57:09 +00:00
package config
import (
"path"
2021-11-11 03:00:38 +00:00
"pikapika/main/controller"
"pikapika/main/database/comic_center"
"pikapika/main/database/network_cache"
"pikapika/main/database/properties"
"pikapika/main/utils"
2021-09-29 23:57:09 +00:00
)
2021-10-19 10:26:12 +00:00
// InitApplication 由不同的平台直接调用, 根据提供的路径初始化数据库, 资料文件夹
2021-09-29 23:57:09 +00:00
func InitApplication(applicationDir string) {
println("初始化 : " + applicationDir)
var databasesDir, remoteDir, downloadDir, tmpDir string
databasesDir = path.Join(applicationDir, "databases")
remoteDir = path.Join(applicationDir, "pictures", "remote")
downloadDir = path.Join(applicationDir, "download")
2021-11-25 06:30:57 +00:00
tmpDir = path.Join(applicationDir, "tmp")
2021-09-29 23:57:09 +00:00
utils.Mkdir(databasesDir)
utils.Mkdir(remoteDir)
utils.Mkdir(downloadDir)
utils.Mkdir(tmpDir)
properties.InitDBConnect(databasesDir)
network_cache.InitDBConnect(databasesDir)
comic_center.InitDBConnect(databasesDir)
controller.InitClient()
controller.InitPlugin(remoteDir, downloadDir, tmpDir)
}