mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-11 01:34:20 +01:00
🎨 使用第三方同步盘时弹出提示并退出内核 https://github.com/siyuan-note/siyuan/issues/7683
This commit is contained in:
parent
2af8b67cbd
commit
f9520e3a08
4 changed files with 59 additions and 43 deletions
|
|
@ -35,13 +35,17 @@ import (
|
|||
func InitAppearance() {
|
||||
util.SetBootDetails("Initializing appearance...")
|
||||
if err := os.Mkdir(util.AppearancePath, 0755); nil != err && !os.IsExist(err) {
|
||||
logging.LogFatalf("create appearance folder [%s] failed: %s", util.AppearancePath, err)
|
||||
logging.LogErrorf("create appearance folder [%s] failed: %s", util.AppearancePath, err)
|
||||
util.ReportFileSysFatalError(err)
|
||||
return
|
||||
}
|
||||
|
||||
unloadThemes()
|
||||
from := filepath.Join(util.WorkingDir, "appearance")
|
||||
if err := gulu.File.Copy(from, util.AppearancePath); nil != err {
|
||||
logging.LogFatalf("copy appearance resources from [%s] to [%s] failed: %s", from, util.AppearancePath, err)
|
||||
logging.LogErrorf("copy appearance resources from [%s] to [%s] failed: %s", from, util.AppearancePath, err)
|
||||
util.ReportFileSysFatalError(err)
|
||||
return
|
||||
}
|
||||
loadThemes()
|
||||
|
||||
|
|
@ -95,7 +99,9 @@ func unloadThemes() {
|
|||
func loadThemes() {
|
||||
themeDirs, err := os.ReadDir(util.ThemesPath)
|
||||
if nil != err {
|
||||
logging.LogFatalf("read appearance themes folder failed: %s", err)
|
||||
logging.LogErrorf("read appearance themes folder failed: %s", err)
|
||||
util.ReportFileSysFatalError(err)
|
||||
return
|
||||
}
|
||||
|
||||
Conf.Appearance.DarkThemes = nil
|
||||
|
|
@ -204,7 +210,9 @@ func widgetJSON(widgetName string) (ret map[string]interface{}, err error) {
|
|||
func loadIcons() {
|
||||
iconDirs, err := os.ReadDir(util.IconsPath)
|
||||
if nil != err {
|
||||
logging.LogFatalf("read appearance icons folder failed: %s", err)
|
||||
logging.LogErrorf("read appearance icons folder failed: %s", err)
|
||||
util.ReportFileSysFatalError(err)
|
||||
return
|
||||
}
|
||||
|
||||
Conf.Appearance.Icons = nil
|
||||
|
|
|
|||
|
|
@ -343,13 +343,17 @@ func initLang() {
|
|||
p := filepath.Join(util.WorkingDir, "appearance", "langs")
|
||||
dir, err := os.Open(p)
|
||||
if nil != err {
|
||||
logging.LogFatalf("open language configuration folder [%s] failed: %s", p, err)
|
||||
logging.LogErrorf("open language configuration folder [%s] failed: %s", p, err)
|
||||
util.ReportFileSysFatalError(err)
|
||||
return
|
||||
}
|
||||
defer dir.Close()
|
||||
|
||||
langNames, err := dir.Readdirnames(-1)
|
||||
if nil != err {
|
||||
logging.LogFatalf("list language configuration folder [%s] failed: %s", p, err)
|
||||
logging.LogErrorf("list language configuration folder [%s] failed: %s", p, err)
|
||||
util.ReportFileSysFatalError(err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, langName := range langNames {
|
||||
|
|
@ -510,7 +514,9 @@ func (conf *AppConf) Save() {
|
|||
func (conf *AppConf) save0(data []byte) {
|
||||
confPath := filepath.Join(util.ConfDir, "conf.json")
|
||||
if err := filelock.WriteFile(confPath, data); nil != err {
|
||||
logging.LogFatalf("write conf [%s] failed: %s", confPath, err)
|
||||
logging.LogErrorf("write conf [%s] failed: %s", confPath, err)
|
||||
util.ReportFileSysFatalError(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue