mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-15 03:28:07 +01:00
This commit is contained in:
parent
2b451eddad
commit
7ef54b0f8f
3 changed files with 37 additions and 1 deletions
|
|
@ -293,6 +293,8 @@ func InitFlashcards() {
|
|||
return
|
||||
}
|
||||
|
||||
Decks = map[string]*riff.Deck{}
|
||||
|
||||
entries, err := os.ReadDir(riffSavePath)
|
||||
if nil != err {
|
||||
logging.LogErrorf("read riff dir failed: %s", err)
|
||||
|
|
@ -320,7 +322,7 @@ func InitFlashcards() {
|
|||
}
|
||||
}
|
||||
|
||||
func RenameDeck(deckID string, name string) (err error) {
|
||||
func RenameDeck(deckID, name string) (err error) {
|
||||
deckLock.Lock()
|
||||
deck := Decks[deckID]
|
||||
deckLock.Unlock()
|
||||
|
|
@ -334,6 +336,21 @@ func RenameDeck(deckID string, name string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func RemoveDeck(deckID string) (err error) {
|
||||
riffSavePath := getRiffDir()
|
||||
deckPath := filepath.Join(riffSavePath, deckID+".deck")
|
||||
if err = os.Remove(deckPath); nil != err {
|
||||
return
|
||||
}
|
||||
cardsPath := filepath.Join(riffSavePath, deckID+".cards")
|
||||
if err = os.Remove(cardsPath); nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
InitFlashcards()
|
||||
return
|
||||
}
|
||||
|
||||
func CreateDeck(name string) (deck *riff.Deck, err error) {
|
||||
riffSavePath := getRiffDir()
|
||||
deckID := ast.NewNodeID()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue