From f93f031745c93e8f77f890497d4a4bb225a5d2f0 Mon Sep 17 00:00:00 2001 From: Anand Gaitonde and Michael Maximilien Date: Fri, 16 May 2014 10:34:04 -0700 Subject: [PATCH] Asset retrieval is independent of OS Path That is for Windows \\ are replaced with / since the asset map uses paths with / --- debug.go | 1 + release.go | 4 ++++ toc.go | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debug.go b/debug.go index 92309b6..9abde60 100644 --- a/debug.go +++ b/debug.go @@ -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. diff --git a/release.go b/release.go index 2f8e23c..f7e6e7c 100644 --- a/release.go +++ b/release.go @@ -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 diff --git a/toc.go b/toc.go index b056e0e..b99bb88 100644 --- a/toc.go +++ b/toc.go @@ -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)