Documentation ¶
Overview ¶
Package gspath implements file index and search for folders.
搜索目录管理, 可以添加搜索目录,按照添加的优先级进行文件检索,并在内部进行高效缓存处理。
Index ¶
- func Search(root string, name string, indexFiles ...string) (filePath string, isDir bool)
- type SPath
- func (sp *SPath) Add(path string) (realPath string, err error)
- func (sp *SPath) AllPaths() []string
- func (sp *SPath) Paths() []string
- func (sp *SPath) Remove(path string)
- func (sp *SPath) Search(name string, indexFiles ...string) (filePath string, isDir bool)
- func (sp *SPath) Set(path string) (realPath string, err error)
- func (sp *SPath) Size() int
- type SPathCacheItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SPath ¶
type SPath struct {
// contains filtered or unexported fields
}
文件目录搜索管理对象
func (*SPath) Search ¶
给定的name只是相对文件路径,找不到该文件时,返回空字符串; 当给定indexFiles时,如果name时一个目录,那么会进一步检索其下对应的indexFiles文件是否存在,存在则返回indexFile绝对路径; 否则返回name目录绝对路径。
type SPathCacheItem ¶
type SPathCacheItem struct {
// contains filtered or unexported fields
}
文件搜索缓存项
Click to show internal directories.
Click to hide internal directories.