Explorar el Código

feat:

pull/1/head
yuan_rh hace 4 años
padre
commit
c4ef2a1f67
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. +3
    -2
      handle/handle.go

+ 3
- 2
handle/handle.go Ver fichero

@@ -487,7 +487,7 @@ type simpleFileInfo struct {
AbsolutePath string `json:"absolutePath"` AbsolutePath string `json:"absolutePath"`
} }


var gobalFolderFileMap = make(map[string] *simpleFileInfo)
var gobalFolderFileMap map[string] *simpleFileInfo
var gobalRelativePath string var gobalRelativePath string
/** /**
获取指定目录或文件的文件信息,如果是目录递归获取文件信息 获取指定目录或文件的文件信息,如果是目录递归获取文件信息
@@ -495,6 +495,7 @@ var gobalRelativePath string
*/ */
func GetFolderFileInfo(conn *websocket.Conn,absolutePath string) error{ func GetFolderFileInfo(conn *websocket.Conn,absolutePath string) error{


gobalFolderFileMap = make(map[string] *simpleFileInfo)
fileInfo,err :=os.Stat(absolutePath) fileInfo,err :=os.Stat(absolutePath)
if err!=nil{ if err!=nil{
log.Println(err) log.Println(err)
@@ -551,7 +552,7 @@ func myWalkfunc(path string, info os.FileInfo, err error) error {
simpleFileInfo := new(simpleFileInfo) simpleFileInfo := new(simpleFileInfo)
simpleFileInfo.Name=info.Name() simpleFileInfo.Name=info.Name()
simpleFileInfo.Extension=filepath.Ext(path) simpleFileInfo.Extension=filepath.Ext(path)
simpleFileInfo.RelativePath=strings.Replace(path,gobalRelativePath,"",1)
simpleFileInfo.RelativePath=filepath.Dir(strings.Replace(path,gobalRelativePath,"",1))
simpleFileInfo.AbsolutePath=path simpleFileInfo.AbsolutePath=path
gobalFolderFileMap[path]=simpleFileInfo gobalFolderFileMap[path]=simpleFileInfo
return nil return nil


Cargando…
Cancelar
Guardar