Asset retrieval is independent of OS Path

That is for Windows \\ are replaced with / since the
asset map uses paths with /
This commit is contained in:
Anand Gaitonde and Michael Maximilien 2014-05-16 10:34:04 -07:00
parent 4b70a41eb8
commit f93f031745
3 changed files with 7 additions and 1 deletions

View File

@ -32,6 +32,7 @@ func writeDebugHeader(w io.Writer) error {
_, err := fmt.Fprintf(w, `import (
"fmt"
"io/ioutil"
"strings"
)
// bindata_read reads the given file from disk. It returns an error on failure.

View File

@ -81,6 +81,7 @@ func header_compressed_nomemcopy(w io.Writer) error {
"fmt"
"io"
"reflect"
"strings"
"unsafe"
)
@ -119,6 +120,7 @@ func header_compressed_memcopy(w io.Writer) error {
"compress/gzip"
"fmt"
"io"
"strings"
)
func bindata_read(data []byte, name string) ([]byte, error) {
@ -146,6 +148,7 @@ func header_uncompressed_nomemcopy(w io.Writer) error {
_, err := fmt.Fprintf(w, `import (
"fmt"
"reflect"
"strings"
"unsafe"
)
@ -167,6 +170,7 @@ func bindata_read(data, name string) ([]byte, error) {
func header_uncompressed_memcopy(w io.Writer) error {
_, err := fmt.Fprintf(w, `import (
"fmt"
"strings"
)
`)
return err

3
toc.go
View File

@ -33,7 +33,8 @@ func writeTOCHeader(w io.Writer) error {
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
if f, ok := _bindata[name]; ok {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
return f()
}
return nil, fmt.Errorf("Asset %%s not found", name)