Documentation
¶
Index ¶
- Constants
- func KeepAbs(path string, rel func(string) string) string
- func MustDir(perm fs.FileMode, forfile string) (file string)
- func ProvideDir(perm fs.FileMode, forfile string) (file string, err error)
- type App
- func (a App) Bin(rel ...string) string
- func (a App) BinPath(rel string) string
- func (a App) CheckDirs(flags AppPath) (res AppPath, err error)
- func (a App) Doc(rel ...string) string
- func (a App) DocPath(rel string) string
- func (a App) Lib(rel ...string) string
- func (a App) LibPath(rel string) string
- func (a App) LocalData(rel ...string) string
- func (a App) LocalDataPath(rel string) string
- func (a App) ProvideDirs(perm fs.FileMode, flags AppPath) error
- func (a App) RoamingData(rel ...string) string
- func (a App) RoamingDataPath(rel string) string
- type AppPath
- type AppPaths
- type DesktopUserApp
- type DirTree
- type SingleDir
Examples ¶
Constants ¶
View Source
const AllPaths = InstallPaths | DataPaths
View Source
const DataPaths = LocalDataPath | RoamingDataPath
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶ added in v0.6.1
type App struct {
// contains filtered or unexported fields
}
func (App) CheckDirs ¶ added in v0.6.2
func (App) ProvideDirs ¶ added in v0.6.2
type AppPaths ¶ added in v0.6.1
type DesktopUserApp ¶ added in v0.6.1
type DesktopUserApp string
func NewDesktopUserApp ¶ added in v0.6.1
func NewDesktopUserApp(username string) DesktopUserApp
func (DesktopUserApp) Bin ¶ added in v0.6.1
func (u DesktopUserApp) Bin(app ...string) string
func (DesktopUserApp) Doc ¶ added in v0.6.1
func (u DesktopUserApp) Doc(app ...string) string
func (DesktopUserApp) Lib ¶ added in v0.6.1
func (u DesktopUserApp) Lib(app ...string) string
func (DesktopUserApp) LocalData ¶ added in v0.6.1
func (u DesktopUserApp) LocalData(app ...string) string
func (DesktopUserApp) RoamingData ¶ added in v0.6.1
func (u DesktopUserApp) RoamingData(app ...string) string
type DirTree ¶ added in v0.6.2
type DirTree struct { RelBin string RelLib string RelDoc string RelLocalData string RelRoamingData string // contains filtered or unexported fields }
Example ¶
d := NewDirTree("basedir", nil) app := NewApp(d, "example-app") fmt.Println(app.Bin("executable")) fmt.Println(app.Lib("sample.so")) fmt.Println(app.Doc("README.md")) fmt.Println(app.LocalData("local.data")) fmt.Println(app.RoamingData("roaming.data"))
Output: basedir/executable basedir/lib/sample.so basedir/doc/README.md basedir/data/local.data basedir/roaming/roaming.data
type SingleDir ¶ added in v0.6.1
type SingleDir string
Example ¶
d := SingleDir("basedir") app := NewApp(d, "example-app") fmt.Println(app.Bin("executable")) fmt.Println(app.Lib("sample.so")) fmt.Println(app.Doc("README.md")) fmt.Println(app.LocalData("local.data")) fmt.Println(app.RoamingData("roaming.data"))
Output: basedir/executable basedir/sample.so basedir/README.md basedir/local.data basedir/roaming.data
Click to show internal directories.
Click to hide internal directories.