mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Physically delete a workspace on the mobile https://github.com/siyuan-note/siyuan/issues/9134
This commit is contained in:
parent
147d083770
commit
5a9a4a1ece
4 changed files with 32 additions and 6 deletions
|
|
@ -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"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue