This commit is contained in:
Liang Ding 2014-11-05 15:24:58 +08:00
parent c804921da1
commit d2e011fe9e
1 changed files with 3 additions and 3 deletions

View File

@ -21,6 +21,7 @@ import (
// File node, used to construct the file tree. // File node, used to construct the file tree.
type FileNode struct { type FileNode struct {
Name string `json:"name"` Name string `json:"name"`
Title string `json:"title"`
Path string `json:"path"` Path string `json:"path"`
IconSkin string `json:"iconSkin"` // Value should be end with a space IconSkin string `json:"iconSkin"` // Value should be end with a space
Type string `json:"type"` // "f": file, "d": directory Type string `json:"type"` // "f": file, "d": directory
@ -56,9 +57,8 @@ func GetFiles(w http.ResponseWriter, r *http.Request) {
for _, workspace := range workspaces { for _, workspace := range workspaces {
workspacePath := workspace + conf.PathSeparator + "src" workspacePath := workspace + conf.PathSeparator + "src"
workspaceNode := FileNode{Name: workspace[strings.LastIndex(workspace, conf.PathSeparator)+1:] + " (" + workspaceNode := FileNode{Name: workspace[strings.LastIndex(workspace, conf.PathSeparator)+1:],
workspace + ")", Title: workspace, Path: workspacePath, IconSkin: "ico-ztree-dir ", Type: "d", FileNodes: []*FileNode{}}
Path: workspacePath, IconSkin: "ico-ztree-dir ", Type: "d", FileNodes: []*FileNode{}}
walk(workspacePath, &workspaceNode) walk(workspacePath, &workspaceNode)