package server import ( "fmt" "io/ioutil" "net/http" "path" ) func notesDir(p Path, w http.ResponseWriter, r *http.Request) { dirs, files := lsDir(p) content := dirs.List() notesDirHead(p, w) block(content, w) fmt.Fprintln(w, files.List()) } func notesDirHead(p Path, w http.ResponseWriter) { fmt.Fprintf(w, `
`, path.Join("/create/", p.BaseHREF)) } func lsDir(path Path) (Paths, Paths) { dirs := newDirs() files := newFiles() found, _ := ioutil.ReadDir(path.Local) for _, f := range found { dirs.Push(path, f) files.Push(path, f) } return Paths(*dirs), Paths(*files) }