|
@@ -41,6 +41,11 @@ func CreateBox(name string) (id string, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ WaitForWritingFiles()
|
|
|
+
|
|
|
+ createDocLock.Lock()
|
|
|
+ defer createDocLock.Unlock()
|
|
|
+
|
|
|
id = ast.NewNodeID()
|
|
|
boxLocalPath := filepath.Join(util.DataDir, id)
|
|
|
err = os.MkdirAll(boxLocalPath, 0755)
|
|
@@ -71,12 +76,15 @@ func RenameBox(boxID, name string) (err error) {
|
|
|
}
|
|
|
|
|
|
func RemoveBox(boxID string) (err error) {
|
|
|
- WaitForWritingFiles()
|
|
|
-
|
|
|
if util.IsReservedFilename(boxID) {
|
|
|
return errors.New(fmt.Sprintf("can not remove [%s] caused by it is a reserved file", boxID))
|
|
|
}
|
|
|
|
|
|
+ WaitForWritingFiles()
|
|
|
+
|
|
|
+ createDocLock.Lock()
|
|
|
+ defer createDocLock.Unlock()
|
|
|
+
|
|
|
localPath := filepath.Join(util.DataDir, boxID)
|
|
|
if !filelock.IsExist(localPath) {
|
|
|
return
|