符号链接支持,可以通过mklink(Windows)或者ln -s (Linux)将其他路径下的文件夹链接到根目录下而无需将文件复制到根目录下.针对删除场景特殊处理,删除整个符号链接目录不会删除链接目录内文件,仅删除链接,在符号链接目录操作同普通目录

This commit is contained in:
wenyifan
2022-07-02 14:32:02 +08:00
parent 1ec66adda0
commit 3f38998fe5
7 changed files with 43 additions and 30 deletions

View File

@ -250,7 +250,7 @@ func (this *MatterService) Delete(request *http.Request, matter *Matter, user *U
panic(result.BadRequest("matter cannot be nil"))
}
this.matterDao.Delete(matter)
this.matterDao.Delete(matter, false, -1)
//re compute the size of Route.
this.ComputeRouteSize(matter.Puuid, user)
@ -987,7 +987,7 @@ func (this *MatterService) mirror(request *http.Request, srcPath string, destDir
this.logger.Info("mirror srcPath = %s destPath = %s", srcPath, destDirMatter.Path)
if fileStat.IsDir() {
if fileStat.IsDir() || (fileStat.Mode()&os.ModeSymlink > 0) {
//判断当前文件夹下,文件是否已经存在了。
srcDirMatter := this.matterDao.FindByUserUuidAndPuuidAndDirAndName(user.Uuid, destDirMatter.Uuid, TRUE, fileStat.Name())
@ -1231,7 +1231,7 @@ func (this *MatterService) ScanPhysics(request *http.Request, user *User) {
}
func (this *MatterService) scanPhysicsFolder(request *http.Request, dirInfo os.FileInfo, dirMatter *Matter, user *User) {
if !dirInfo.IsDir() {
if !dirInfo.IsDir() && !(dirInfo.Mode()&os.ModeSymlink > 0) {
return
}
@ -1277,7 +1277,7 @@ func (this *MatterService) scanPhysicsFolder(request *http.Request, dirInfo os.F
} else {
if fileInfo.IsDir() {
if fileInfo.IsDir() || (fileInfo.Mode()&os.ModeSymlink > 0) {
//create folder.
matter = this.createDirectory(request, dirMatter, name, user)