mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-18 00:19:58 +01:00
*BREAKING CHANGE* move Path and Paths methods into application package.
This commit is contained in:
parent
631c8a1cc8
commit
46bb4e8414
3 changed files with 17 additions and 16 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue