🎨 资源文件夹不存在时自动创建

This commit is contained in:
Liang Ding 2022-10-09 10:04:39 +08:00
parent f3413cb583
commit 7959a6a994
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -19,9 +19,11 @@
package model
import (
"os"
"path/filepath"
"time"
"github.com/88250/gulu"
"github.com/fsnotify/fsnotify"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/cache"
@ -89,6 +91,10 @@ func watchAssets() {
}
}()
if !gulu.File.IsDir(assetsDir) {
os.MkdirAll(assetsDir, 0755)
}
if err = assetsWatcher.Add(assetsDir); err != nil {
logging.LogErrorf("add assets watcher for folder [%s] failed: %s", assetsDir, err)
}