mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
🎨 去掉工作空间路径尾部空格 Fix https://github.com/siyuan-note/siyuan/issues/6353
This commit is contained in:
parent
92e4df2483
commit
aecce8ac40
2 changed files with 6 additions and 0 deletions
|
|
@ -38,6 +38,11 @@ func listWorkspaceDirs(c *gin.Context) {
|
||||||
userHomeConfDir := filepath.Join(util.HomeDir, ".config", "siyuan")
|
userHomeConfDir := filepath.Join(util.HomeDir, ".config", "siyuan")
|
||||||
workspaceConf := filepath.Join(userHomeConfDir, "workspace.json")
|
workspaceConf := filepath.Join(userHomeConfDir, "workspace.json")
|
||||||
data, err := os.ReadFile(workspaceConf)
|
data, err := os.ReadFile(workspaceConf)
|
||||||
|
if nil != err {
|
||||||
|
logging.LogErrorf("read workspace conf [%s] failed: %s", workspaceConf, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var workspacePaths []string
|
var workspacePaths []string
|
||||||
if err = gulu.JSON.UnmarshalJSON(data, &workspacePaths); nil != err {
|
if err = gulu.JSON.UnmarshalJSON(data, &workspacePaths); nil != err {
|
||||||
logging.LogErrorf("unmarshal workspace conf [%s] failed: %s", workspaceConf, err)
|
logging.LogErrorf("unmarshal workspace conf [%s] failed: %s", workspaceConf, err)
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,7 @@ func initWorkspaceDir(workspaceArg string) {
|
||||||
|
|
||||||
tmp := workspacePaths[:0]
|
tmp := workspacePaths[:0]
|
||||||
for _, d := range workspacePaths {
|
for _, d := range workspacePaths {
|
||||||
|
d = strings.TrimRight(d, " \t\n") // 去掉工作空间路径尾部空格 https://github.com/siyuan-note/siyuan/issues/6353
|
||||||
if gulu.File.IsDir(d) {
|
if gulu.File.IsDir(d) {
|
||||||
tmp = append(tmp, d)
|
tmp = append(tmp, d)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue