fs.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
package main
import (
"net/http"
"os"
)
type nodirFileSystem struct {
fs http.FileSystem
}
func (nd nodirFileSystem) Open(path string) (http.File, error) {
f, err := nd.fs.Open(path)
if err != nil {
return nil, err
}
s, err := f.Stat()
if s.IsDir() {
return nil, os.ErrNotExist
}
return f, nil
}
|