forked from mirror/pkger
22 lines
633 B
Go
22 lines
633 B
Go
package pkger
|
|
|
|
import "github.com/markbates/pkger/paths"
|
|
|
|
// Open opens the named file for reading.
|
|
func Open(p string) (*File, error) {
|
|
pt, err := paths.Parse(p)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rootIndex.Open(pt)
|
|
}
|
|
|
|
// Create creates the named file with mode 0666 (before umask), truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. If there is an error, it will be of type *PathError.
|
|
func Create(p string) (*File, error) {
|
|
pt, err := paths.Parse(p)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rootIndex.Create(pt)
|
|
}
|