| 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 | //go:build (linux && !android) || (darwin && !ios) || 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 | } |