gitea-tea/vendor/github.com/adrg/xdg/paths_darwin.go
crapStone c4e2db32b5 rewrote config file path search (#219)
added comment to clarify coding choices

added package xdg to vendor folder

rewrote config file path search

Co-authored-by: crapStone <crapstone01@gmail.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/219
Reviewed-by: 6543 <6543@noreply.gitea.io>
Reviewed-by: Norwin <noerw@noreply.gitea.io>
2020-10-06 13:06:47 +00:00

38 lines
1.5 KiB
Go

package xdg
import (
"path/filepath"
)
func initBaseDirs(home string) {
// Initialize base directories.
baseDirs.dataHome = xdgPath(envDataHome, filepath.Join(home, "Library", "Application Support"))
baseDirs.data = xdgPaths(envDataDirs, "/Library/Application Support")
baseDirs.configHome = xdgPath(envConfigHome, filepath.Join(home, "Library", "Preferences"))
baseDirs.config = xdgPaths(envConfigDirs, "/Library/Preferences")
baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(home, "Library", "Caches"))
baseDirs.runtime = xdgPath(envRuntimeDir, filepath.Join(home, "Library", "Application Support"))
// Initialize non-standard directories.
baseDirs.applications = []string{
"/Applications",
}
baseDirs.fonts = []string{
filepath.Join(home, "Library/Fonts"),
"/Library/Fonts",
"/System/Library/Fonts",
"/Network/Library/Fonts",
}
}
func initUserDirs(home string) {
UserDirs.Desktop = xdgPath(envDesktopDir, filepath.Join(home, "Desktop"))
UserDirs.Download = xdgPath(envDownloadDir, filepath.Join(home, "Downloads"))
UserDirs.Documents = xdgPath(envDocumentsDir, filepath.Join(home, "Documents"))
UserDirs.Music = xdgPath(envMusicDir, filepath.Join(home, "Music"))
UserDirs.Pictures = xdgPath(envPicturesDir, filepath.Join(home, "Pictures"))
UserDirs.Videos = xdgPath(envVideosDir, filepath.Join(home, "Movies"))
UserDirs.Templates = xdgPath(envTemplatesDir, filepath.Join(home, "Templates"))
UserDirs.PublicShare = xdgPath(envPublicShareDir, filepath.Join(home, "Public"))
}