github.com/acrespo/mobile@v0.0.0-20190107162257-dc0771356504/asset/asset_desktop.go (about)

     1  // Copyright 2014 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build linux,!android darwin,!arm,!arm64 windows
     6  
     7  package asset
     8  
     9  import (
    10  	"os"
    11  	"path/filepath"
    12  )
    13  
    14  func openAsset(name string) (File, error) {
    15  	if !filepath.IsAbs(name) {
    16  		name = filepath.Join("assets", name)
    17  	}
    18  	f, err := os.Open(name)
    19  	if err != nil {
    20  		return nil, err
    21  	}
    22  	return f, nil
    23  }