You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
582 B
30 lines
582 B
// +build gopherjsdev
|
|
|
|
package natives
|
|
|
|
import (
|
|
"go/build"
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/shurcooL/httpfs/filter"
|
|
)
|
|
|
|
func importPathToDir(importPath string) string {
|
|
p, err := build.Import(importPath, "", build.FindOnly)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
return p.Dir
|
|
}
|
|
|
|
// FS is a virtual filesystem that contains native packages.
|
|
var FS = filter.Keep(
|
|
http.Dir(importPathToDir("github.com/gopherjs/gopherjs/compiler/natives")),
|
|
func(path string, fi os.FileInfo) bool {
|
|
return path == "/" || path == "/src" || strings.HasPrefix(path, "/src/")
|
|
},
|
|
)
|