This commit is contained in:
Liang Ding 2022-12-21 14:46:27 +08:00
parent 1c5eccd510
commit edd90ce7cf
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D

View File

@ -17,14 +17,16 @@
package model package model
import ( import (
"github.com/88250/lute/ast" "github.com/88250/gulu"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/riff"
"github.com/siyuan-note/siyuan/kernel/util"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"sync" "sync"
"github.com/88250/lute/ast"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/riff"
"github.com/siyuan-note/siyuan/kernel/util"
) )
var Decks = map[string]*riff.Deck{} var Decks = map[string]*riff.Deck{}
@ -47,6 +49,10 @@ func AddFlashcard(blockID string, deckName string) (err error) {
func InitFlashcards() { func InitFlashcards() {
riffSavePath := filepath.Join(util.DataDir, "storage", "riff") riffSavePath := filepath.Join(util.DataDir, "storage", "riff")
if !gulu.File.IsDir(riffSavePath) {
return
}
entries, err := os.ReadDir(riffSavePath) entries, err := os.ReadDir(riffSavePath)
if nil != err { if nil != err {
logging.LogErrorf("read riff dir failed: %s", err) logging.LogErrorf("read riff dir failed: %s", err)