🎨 Physically delete a workspace on the mobile https://github.com/siyuan-note/siyuan/issues/9134

This commit is contained in:
Daniel 2023-09-08 15:36:11 +08:00
parent 147d083770
commit 5a9a4a1ece
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 32 additions and 6 deletions

View file

@ -163,6 +163,31 @@ func removeWorkspaceDir(c *gin.Context) {
}
}
func removeWorkspaceDirPhysically(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
path := arg["path"].(string)
if gulu.File.IsDir(path) {
err := os.RemoveAll(path)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
}
if util.WorkspaceDir == path {
os.Exit(logging.ExitCodeOk)
}
}
type Workspace struct {
Path string `json:"path"`
Closed bool `json:"closed"`