github.com/ethereumproject/go-ethereum@v5.5.2+incompatible/core/helpers_windows.go (about)

     1  package core
     2  
     3  import (
     4  	"fmt"
     5  	"io"
     6  	"strings"
     7  
     8  	"github.com/ethereumproject/go-ethereum/core/assets"
     9  )
    10  
    11  func assetsOpen(path string) (io.ReadCloser, error) {
    12  	// this is dirty hack, but /such/path is considered as NOT absolute path on windows,
    13  	// and because of that we process the path as relative. But we know, that asset paths
    14  	// are always absolute. Moreover, we need to fish slashes ("broken" by filepath.Join).
    15  	path = "/" + strings.Replace(path, "\\", "/", -1)
    16  
    17  	file, err := assets.DEFAULTS.Open(path)
    18  	if err != nil {
    19  		err = fmt.Errorf("Error opening '%s' default JSON: %v", path, err)
    20  	}
    21  	return file, err
    22  }