fix: 解决编排目录跳转失败的问题 (#4921)

Refs #4895
This commit is contained in:
ssongliu 2024-05-08 17:36:23 +08:00 committed by GitHub
parent a6f354fed9
commit d7df881da9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@ import (
"encoding/base64"
"encoding/json"
"os"
"path"
"strings"
"github.com/1Panel-dev/1Panel/backend/app/model"
@ -63,6 +64,7 @@ func Init() {
handleCronjobStatus()
handleSnapStatus()
loadLocalDir()
initDir()
}
func handleSnapStatus() {
@ -198,3 +200,13 @@ func handleUserInfo(tags string, settingRepo repo.ISettingRepo) {
sudo := cmd.SudoHandleCmd()
_, _ = cmd.Execf("%s sed -i '/CHANGE_USER_INFO=%v/d' /usr/local/bin/1pctl", sudo, global.CONF.System.ChangeUserInfo)
}
func initDir() {
composePath := path.Join(global.CONF.System.BaseDir, "1panel/docker/compose/")
if _, err := os.Stat(composePath); err != nil && os.IsNotExist(err) {
if err = os.MkdirAll(composePath, os.ModePerm); err != nil {
global.LOG.Errorf("mkdir %s failed, err: %v", composePath, err)
return
}
}
}