Skip to content

CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.

update create file and dir api

link8a28d3c58978
diff --git a/.gitignore b/.gitignore
index c6d0486..ff73408 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,4 @@ gen
/db/
/docs/
/conf/conf.ini
+__debug_bin
diff --git a/UI b/UI
index f2a5429..0a78d55 160000
--- a/UI
+++ b/UI
@@ -1 +1 @@
-Subproject commit f2a5429db57171af5f1e47df7042a6181a4b25d7
+Subproject commit 0a78d55a82dbeb10e617189358f8747629045377
diff --git a/__debug_bin b/__debug_bin
deleted file mode 100755
index 519a8a7..0000000
Binary files a/__debug_bin and /dev/null differ
diff --git a/pkg/utils/oasis_err/e.go b/pkg/utils/oasis_err/e.go
index 8ce043c..9f335f5 100644
--- a/pkg/utils/oasis_err/e.go
+++ b/pkg/utils/oasis_err/e.go
@@ -10,7 +10,9 @@ const (
PWD_INVALID = 10001
//system
- DIR_ALREADY_EXISTS = 20001
+ DIR_ALREADY_EXISTS = 20001
+ FILE_ALREADY_EXISTS = 20002
+ FILE_OR_DIR_EXISTS = 20003
//zerotier
GET_TOKEN_ERROR = 30001
@@ -38,8 +40,9 @@ var MsgFlags = map[int]string{
PWD_INVALID: "Password invalid",
//system
- DIR_ALREADY_EXISTS: "Directory already exists",
-
+ DIR_ALREADY_EXISTS: "Directory already exists",
+ FILE_ALREADY_EXISTS: "File already exists",
+ FILE_OR_DIR_EXISTS: "File or directory already exists",
//zerotier
GET_TOKEN_ERROR: "Get token error,Please log in to zerotier's official website to confirm whether the account is available",
diff --git a/service/zima_info.go b/service/zima_info.go
index 242f89e..86f6000 100644
--- a/service/zima_info.go
+++ b/service/zima_info.go
@@ -86,7 +86,12 @@ func (c *zima) GetDirPath(path string) []model.Path {
if strings.Count(path, "/") > 1 {
for _, l := range ls {
- dirs = append(dirs, model.Path{Name: l.Name(), Path: path + l.Name() + "/", IsDir: l.IsDir()})
+ pathTemp := path + l.Name()
+ if l.IsDir() {
+ pathTemp += "/"
+ }
+
+ dirs = append(dirs, model.Path{Name: l.Name(), Path: pathTemp, IsDir: l.IsDir()})
}
} else {
dirs = append(dirs, model.Path{Name: "DATA", Path: "/DATA/", IsDir: true})
@@ -131,6 +136,8 @@ func (c *zima) MkdirAll(path string) (int, error) {
if os.IsNotExist(err) {
os.MkdirAll(path, os.ModePerm)
return oasis_err.SUCCESS, nil
+ } else if strings.Contains(err.Error(), ": not a directory") {
+ return oasis_err.FILE_OR_DIR_EXISTS, err
}
}
return oasis_err.ERROR, err
@@ -140,7 +147,7 @@ func (c *zima) MkdirAll(path string) (int, error) {
func (c *zima) CreateFile(path string) (int, error) {
_, err := os.Stat(path)
if err == nil {
- return oasis_err.DIR_ALREADY_EXISTS, nil
+ return oasis_err.FILE_OR_DIR_EXISTS, nil
} else {
if os.IsNotExist(err) {
file.CreateFile(path)
diff --git a/types/system.go b/types/system.go
index c099eae..4793dc3 100644
--- a/types/system.go
+++ b/types/system.go
@@ -1,10 +1,4 @@
package types
-const CURRENTVERSION = "0.1.5"
-const BODY = `
-<li>Add CPU RAM Status with widget</li>
-<li>Add Disk Info with widget</li>
-<li>Enhance the Docker cli import experience and automatically fill in the folders that need to be mounted</li>
-<li>Realize automatic loading of widgets</li>
-<li>Fix display bugs when windows size less than 1024px</li>
-`
+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>"