diff --git a/docs/src/content/docs/changelog.mdx b/docs/src/content/docs/changelog.mdx index db29e026c..7876778cc 100644 --- a/docs/src/content/docs/changelog.mdx +++ b/docs/src/content/docs/changelog.mdx @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking Changes - Renamed Service methods: `Name` -> `ServiceName`, `OnStartup` -> `ServiceStartup`, `OnShutdown` -> `ServiceShutdown` by [@leaanthony](https://github.com/leaanthony) +- Moved `Path` and `Paths` methods to `application` package by [@leaanthony](https://github.com/leaanthony) ### Added diff --git a/v3/pkg/application/application.go b/v3/pkg/application/application.go index 3f35c37b8..5cdb8a3ba 100644 --- a/v3/pkg/application/application.go +++ b/v3/pkg/application/application.go @@ -1077,16 +1077,6 @@ func (a *App) shouldQuit() bool { return true } -// Path returns the path for the given selector -func (a *App) Path(selector Path) string { - return paths[selector] -} - -// Paths returns the paths for the given selector -func (a *App) Paths(selector Paths) []string { - return pathdirs[selector] -} - // OpenFileManager opens the file manager at the specified path, optionally selecting the file. func (a *App) OpenFileManager(path string, selectFile bool) error { return InvokeSyncWithError(func() error { diff --git a/v3/pkg/application/path.go b/v3/pkg/application/path.go index 867e5b678..44066fa96 100644 --- a/v3/pkg/application/path.go +++ b/v3/pkg/application/path.go @@ -2,11 +2,11 @@ package application import "github.com/adrg/xdg" -type Path int +type PathType int const ( // PathHome is the user's home directory. - PathHome Path = iota + PathHome PathType = iota // PathDataHome defines the base directory relative to which user-specific // data files should be stored. This directory is defined by the @@ -68,7 +68,7 @@ const ( PathPublicShare ) -var paths = map[Path]string{ +var paths = map[PathType]string{ PathHome: xdg.Home, PathDataHome: xdg.DataHome, PathConfigHome: xdg.ConfigHome, @@ -85,7 +85,7 @@ var paths = map[Path]string{ PathPublicShare: xdg.UserDirs.PublicShare, } -type Paths int +type PathTypes int const ( // PathsDataDirs defines the preference-ordered set of base directories to @@ -96,7 +96,7 @@ const ( // DataHome directory is considered more important than any of the // directories defined by DataDirs. Therefore, user data files should be // written relative to the DataHome directory, if possible. - PathsDataDirs = iota + PathsDataDirs PathTypes = iota // PathsConfigDirs defines the preference-ordered set of base directories // search for configuration files in addition to the ConfigHome base @@ -115,9 +115,19 @@ const ( PathsApplicationDirs ) -var pathdirs = map[Paths][]string{ +var pathdirs = map[PathTypes][]string{ PathsDataDirs: xdg.DataDirs, PathsConfigDirs: xdg.ConfigDirs, PathsFontDirs: xdg.FontDirs, PathsApplicationDirs: xdg.ApplicationDirs, } + +// Path returns the path for the given selector +func Path(selector PathType) string { + return paths[selector] +} + +// Paths returns the paths for the given selector +func Paths(selector PathTypes) []string { + return pathdirs[selector] +}