🎨 Improve open/remove notebook
This commit is contained in:
parent
e0adb2f60c
commit
c18b79d374
6 changed files with 34 additions and 9 deletions
|
@ -1457,6 +1457,7 @@
|
|||
"235": "[%d/%d] is updating the marketplace package...",
|
||||
"236": "[%d/%d] is updating the marketplace package [%s]...",
|
||||
"237": "[%d] marketplace packages have all been updated successfully",
|
||||
"238": "Marketplace package [%s] update failed, please try again later"
|
||||
"238": "Marketplace package [%s] update failed, please try again later",
|
||||
"239": "Related operations are being processed, please try again later"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1457,6 +1457,7 @@
|
|||
"235": "[%d/%d] está actualizando el paquete del mercado...",
|
||||
"236": "[%d/%d] está actualizando el paquete del mercado [%s]...",
|
||||
"237": "[%d] todos los paquetes del mercado se han actualizado correctamente",
|
||||
"238": "Error en la actualización del paquete Marketplace [%s], inténtalo de nuevo más tarde"
|
||||
"238": "Error en la actualización del paquete Marketplace [%s], inténtalo de nuevo más tarde",
|
||||
"239": "Las operaciones relacionadas se están procesando, inténtalo de nuevo más tarde"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1457,6 +1457,7 @@
|
|||
"235": "[%d/%d] met à jour le package Marketplace...",
|
||||
"236": "[%d/%d] met à jour le package Marketplace [%s]...",
|
||||
"237": "[%d] packages Marketplace ont tous été mis à jour avec succès",
|
||||
"238": "La mise à jour du package Marketplace [%s] a échoué, veuillez réessayer plus tard"
|
||||
"238": "La mise à jour du package Marketplace [%s] a échoué, veuillez réessayer plus tard",
|
||||
"239": "Les opérations associées sont en cours de traitement, veuillez réessayer plus tard"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1457,6 +1457,7 @@
|
|||
"235": "[%d/%d] 正在更新市集包...",
|
||||
"236": "[%d/%d] 正在更新市集包 [%s]...",
|
||||
"237": "[%d] 個市集包已經全部更新成功",
|
||||
"238": "市集包 [%s] 更新失敗,請稍後再試"
|
||||
"238": "市集包 [%s] 更新失敗,請稍後再試",
|
||||
"239": "相關操作正在處理中,請稍後再試"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1457,6 +1457,7 @@
|
|||
"235": "[%d/%d] 正在更新集市包...",
|
||||
"236": "[%d/%d] 正在更新集市包 [%s]...",
|
||||
"237": "[%d] 个集市包已经全部更新成功",
|
||||
"238": "集市包 [%s] 更新失败,请稍后再试"
|
||||
"238": "集市包 [%s] 更新失败,请稍后再试",
|
||||
"239": "相关操作正在处理中,请稍后再试"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
|
@ -88,13 +89,23 @@ func RenameBox(boxID, name string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
var boxLock = sync.Map{}
|
||||
|
||||
func RemoveBox(boxID string) (err error) {
|
||||
if _, ok := boxLock.Load(boxID); ok {
|
||||
err = fmt.Errorf(Conf.language(239))
|
||||
return
|
||||
}
|
||||
|
||||
boxLock.Store(boxID, true)
|
||||
defer boxLock.Delete(boxID)
|
||||
|
||||
if util.IsReservedFilename(boxID) {
|
||||
return errors.New(fmt.Sprintf("can not remove [%s] caused by it is a reserved file", boxID))
|
||||
}
|
||||
|
||||
WaitForWritingFiles()
|
||||
|
||||
isUserGuide := IsUserGuide(boxID)
|
||||
createDocLock.Lock()
|
||||
defer createDocLock.Unlock()
|
||||
|
||||
|
@ -106,7 +117,7 @@ func RemoveBox(boxID string) (err error) {
|
|||
return errors.New(fmt.Sprintf("can not remove [%s] caused by it is not a dir", boxID))
|
||||
}
|
||||
|
||||
if !IsUserGuide(boxID) {
|
||||
if !isUserGuide {
|
||||
var historyDir string
|
||||
historyDir, err = GetHistoryDir(HistoryOpDelete)
|
||||
if nil != err {
|
||||
|
@ -155,11 +166,20 @@ func unmount0(boxID string) {
|
|||
}
|
||||
|
||||
func Mount(boxID string) (alreadyMount bool, err error) {
|
||||
if _, ok := boxLock.Load(boxID); ok {
|
||||
err = fmt.Errorf(Conf.language(239))
|
||||
return
|
||||
}
|
||||
|
||||
boxLock.Store(boxID, true)
|
||||
defer boxLock.Delete(boxID)
|
||||
|
||||
WaitForWritingFiles()
|
||||
isUserGuide := IsUserGuide(boxID)
|
||||
|
||||
localPath := filepath.Join(util.DataDir, boxID)
|
||||
var reMountGuide bool
|
||||
if IsUserGuide(boxID) {
|
||||
if isUserGuide {
|
||||
// 重新挂载帮助文档
|
||||
|
||||
guideBox := Conf.Box(boxID)
|
||||
|
@ -226,7 +246,7 @@ func Mount(boxID string) (alreadyMount bool, err error) {
|
|||
treenode.SaveBlockTree(false)
|
||||
util.ClearPushProgress(100)
|
||||
|
||||
if IsUserGuide(boxID) {
|
||||
if isUserGuide {
|
||||
go func() {
|
||||
var startID string
|
||||
i := 0
|
||||
|
|
Loading…
Add table
Reference in a new issue