27 lines
463 B
Go
Executable File
27 lines
463 B
Go
Executable File
package server
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"net/http"
|
|
)
|
|
|
|
func notesDir(path Path, w http.ResponseWriter, r *http.Request) {
|
|
dirs, files := lsDir(path)
|
|
content := dirs.List()
|
|
block(content, w)
|
|
fmt.Fprintln(w, files.List())
|
|
}
|
|
|
|
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)
|
|
}
|