Optimize installation process

auto create file or dir
This commit is contained in:
link 2021-10-19 19:07:16 +08:00
parent 8a28d3c589
commit 39ccbe251f
4 changed files with 8 additions and 11 deletions

2
UI

@ -1 +1 @@
Subproject commit 0a78d55a82dbeb10e617189358f8747629045377 Subproject commit 645e6cac7dcc188d310b7fa7add3d03688021d23

View file

@ -7,6 +7,7 @@ import (
"encoding/binary" "encoding/binary"
json2 "encoding/json" json2 "encoding/json"
"fmt" "fmt"
"regexp"
"syscall" "syscall"
model2 "github.com/IceWhaleTech/CasaOS/service/model" model2 "github.com/IceWhaleTech/CasaOS/service/model"
@ -417,9 +418,10 @@ func (ds *dockerService) DockerContainerCreate(imageName string, containerDbId s
if len(path) == 0 { if len(path) == 0 {
continue continue
} }
} }
if strings.HasSuffix(path, "/") { reg1 := regexp.MustCompile(`([^<>/\\\|:""\*\?]+\.\w+$)`)
result1 := reg1.FindAllStringSubmatch(path, -1)
if len(result1) == 0 {
err = file.IsNotExistMkDir(path) err = file.IsNotExistMkDir(path)
if err != nil { if err != nil {
ds.log.Error("mkdir error", err) ds.log.Error("mkdir error", err)

View file

@ -84,14 +84,9 @@ func (c *zima) GetDirPath(path string) []model.Path {
ls, _ := ioutil.ReadDir(path) ls, _ := ioutil.ReadDir(path)
dirs := []model.Path{} dirs := []model.Path{}
if strings.Count(path, "/") > 1 { if strings.Count(path, "/") > 0 {
for _, l := range ls { for _, l := range ls {
pathTemp := path + l.Name() dirs = append(dirs, model.Path{Name: l.Name(), Path: path + "/" + l.Name(), IsDir: l.IsDir()})
if l.IsDir() {
pathTemp += "/"
}
dirs = append(dirs, model.Path{Name: l.Name(), Path: pathTemp, IsDir: l.IsDir()})
} }
} else { } else {
dirs = append(dirs, model.Path{Name: "DATA", Path: "/DATA/", IsDir: true}) dirs = append(dirs, model.Path{Name: "DATA", Path: "/DATA/", IsDir: true})

View file

@ -1,4 +1,4 @@
package types package types
const CURRENTVERSION = "0.1.6" const CURRENTVERSION = "0.1.6"
const BODY = "<li>Add a file selector for app install.</li> <li>Fixed an issue with the app were it would disappear when the app was modified.</li>" const BODY = "<li>Modify import reminder.</li><li>Add app icon auto-fill via docker image name.</li><li>Add a file selector for app install.</li> <li>Fixed an issue with the app were it would disappear when the app was modified.</li>"