2021-09-29 23:57:09 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path"
|
2021-10-22 02:24:39 +00:00
|
|
|
"pikapi/main/controller"
|
|
|
|
"pikapi/main/database/comic_center"
|
|
|
|
"pikapi/main/database/network_cache"
|
|
|
|
"pikapi/main/database/properties"
|
|
|
|
"pikapi/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")
|
|
|
|
tmpDir = path.Join(applicationDir, "download")
|
|
|
|
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)
|
|
|
|
}
|