1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

Switch to github.com/adrg/xdg

This commit is contained in:
Ching Pei Yang
2023-08-17 13:52:55 +02:00
committed by Stefan Haller
parent 4302018437
commit 2118ecdf8e
30 changed files with 1515 additions and 363 deletions

60
vendor/github.com/adrg/xdg/paths_darwin.go generated vendored Normal file
View File

@ -0,0 +1,60 @@
package xdg
import (
"os"
"path/filepath"
)
func homeDir() string {
if home := os.Getenv("HOME"); home != "" {
return home
}
return "/"
}
func initDirs(home string) {
initBaseDirs(home)
initUserDirs(home)
}
func initBaseDirs(home string) {
homeAppSupport := filepath.Join(home, "Library", "Application Support")
rootAppSupport := "/Library/Application Support"
// Initialize standard directories.
baseDirs.dataHome = xdgPath(envDataHome, homeAppSupport)
baseDirs.data = xdgPaths(envDataDirs, rootAppSupport)
baseDirs.configHome = xdgPath(envConfigHome, homeAppSupport)
baseDirs.config = xdgPaths(envConfigDirs,
filepath.Join(home, "Library", "Preferences"),
rootAppSupport,
"/Library/Preferences",
)
baseDirs.stateHome = xdgPath(envStateHome, homeAppSupport)
baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(home, "Library", "Caches"))
baseDirs.runtime = xdgPath(envRuntimeDir, homeAppSupport)
// 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"))
}