Quellcode durchsuchen

feat:

pull/1/head
yuan_rh vor 4 Jahren
Ursprung
Commit
c4ef2a1f67
1 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen
  1. +3
    -2
      handle/handle.go

+ 3
- 2
handle/handle.go Datei anzeigen

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

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

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


Laden…
Abbrechen
Speichern