Documentation ¶
Overview ¶
Package fs provides a primitive virtual file system.
Index ¶
- Variables
- func Abs(paths ...string) []string
- func Content(path string) ([]byte, error)
- func FindASN1Files(dir string) []string
- func FindCFiles(dir string) []string
- func FindFilesRecursive(dir string) []string
- func FindK3EnvInCurrPath(dir string) string
- func FindTTCN3DirectoriesRecursive(dir string) []string
- func FindTTCN3Files(dir string) []string
- func FindTTCN3FilesRecursive(dir string) []string
- func Glob(s string) []string
- func HasASN1Extension(file string) bool
- func HasCExtension(file string) bool
- func HasTTCN3Extension(file string) bool
- func IsDir(path string) bool
- func IsFsRoot(path string) bool
- func IsRegular(path string) bool
- func IsURI(s string) bool
- func JoinPath(baseUrl string, elem ...string) string
- func Path(s string) string
- func PathSlice(files ...*File) []string
- func Real(base, path string) string
- func Rel(base string, paths ...string) []string
- func ReplaceExt(path string, newExt string) string
- func SetContent(path string, b []byte)
- func Slugify(s string) string
- func Stem(s string) string
- func TTCN3Files(paths ...string) ([]string, error)
- func URI(path string) span.URI
- func WalkUp(path string, f func(path string) bool)
- type File
- type Store
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidFileExtension = errors.New("invalid file extension")
)
Functions ¶
func FindASN1Files ¶
FindASN1Files returns a list of ASN.1 files (.asn, asn1).
func FindCFiles ¶
FindCFiles returns a list of C/C++ files (.c, .cc, .cxx, .cpp).
func FindFilesRecursive ¶ added in v0.9.1
FindFilesRecursive returns a list files from the whole directory subtree.
func FindK3EnvInCurrPath ¶ added in v0.9.1
FindK3EnvInCurrPath returns the path of the directory containing k3.env
func FindTTCN3DirectoriesRecursive ¶ added in v0.9.2
FindTTCN3DirectoriesRecursive returns a list of directories containing TTCN-3 source files.
func FindTTCN3Files ¶
FindTTCN3Files returns a list of TTCN-3 source files (.ttcn3, .ttcn, .ttcnpp) in the given directory.
func FindTTCN3FilesRecursive ¶ added in v0.9.2
FindTTCN3FilesRecursive returns a list TTCN-3 source files available in directory sub-tree.
func HasASN1Extension ¶
HasASN1Extension returns true if file has suffix .asn or .asn1
func HasCExtension ¶
HasCExtension returns true if file has suffix .c, .cc, .cxx or .cpp
func HasTTCN3Extension ¶
HasTTCN3Extension returns true if file has suffix .ttcn3 or .ttcn
func IsFsRoot ¶ added in v0.9.3
IsFsRoot returns true if the supplied path coincides with the filesystem root
func JoinPath ¶ added in v0.16.2
JoinPath joins any number of path elements into a single path, separating them with an OS specific Separator. Empty elements are ignored. The result is Cleaned. If the argument list is empty or all its elements are empty, JoinPath returns an empty string.
If baseUrl is an absolute URL, JoinPath will will keep the scheme of the first argument and separats the rest with a slash.
func Path ¶ added in v0.9.1
Path returns a decoded file path when you pass a URI with file:// scheme.
func Rel ¶ added in v0.9.1
Rel makes paths relative to base, when not absolute already. Use it when when you want to make a path relative to a test suite manifest.
func ReplaceExt ¶ added in v0.12.0
func SetContent ¶ added in v0.9.1
SetContent of (virtual) file specified by path.
func TTCN3Files ¶ added in v0.9.2
TTCN3Files takes a list of paths and replaces all paths describing a directory with the TTCN-3 files contained in that directory.
A error is returned for each path which is not accessable or for each (non-directory), which does not have a TTCN-3 extension.
This function a conventient way to "flatten" the Sources of a project.Config struct, for example.
Types ¶
type File ¶
type File struct { // We export the handle until we have better alternatives for cache invalidation. Handle *memoize.Handle // contains filtered or unexported fields }
A File represents a open file
func (*File) Bytes ¶
Bytes returns the contents of File. If content was not specified using SetBytes, Bytes will try reading the file path's content from disk.
func (*File) Reset ¶
func (f *File) Reset()
Reset sets the content to zero. This is identcal to SetBytes(nil)