diff --git a/README.md b/README.md index 2f1a67b..205cf68 100644 --- a/README.md +++ b/README.md @@ -71,16 +71,16 @@ Sensible fallback locations are used for the folders which are not set. Unix-like operating systems
-| |

Unix

|

macOS

|

Plan 9

| -| :------------------------------------------------------------: | :-----------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------: | -| XDG_DATA_HOME | ~/.local/share | ~/Library/Application Support | $home/lib | -| XDG_DATA_DIRS | /usr/local/share
/usr/share | /Library/Application Support | /lib | -| XDG_CONFIG_HOME | ~/.config | ~/Library/Application Support | $home/lib | -| XDG_CONFIG_DIRS | /etc/xdg | ~/Library/Preferences
/Library/Application Support
/Library/Preferences | /lib | -| XDG_STATE_HOME | ~/.local/state | ~/Library/Application Support | $home/lib/state | -| XDG_CACHE_HOME | ~/.cache | ~/Library/Caches | $home/lib/cache | -| XDG_RUNTIME_DIR | /run/user/UID | ~/Library/Application Support | /tmp | -| XDG_BIN_HOME | ~/.local/bin | ~/.local/bin | $home/bin | +| |

Unix

|

macOS

|

Plan 9

| +| :------------------------------------------------------------: | :-----------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------: | +| XDG_DATA_HOME | ~/.local/share | ~/Library/Application Support | $home/lib | +| XDG_DATA_DIRS | /usr/local/share
/usr/share | /Library/Application Support~/.local/share | /lib | +| XDG_CONFIG_HOME | ~/.config | ~/Library/Application Support | $home/lib | +| XDG_CONFIG_DIRS | /etc/xdg | ~/Library/Preferences
/Library/Application Support
/Library/Preferences
~/.config | /lib | +| XDG_STATE_HOME | ~/.local/state | ~/Library/Application Support | $home/lib/state | +| XDG_CACHE_HOME | ~/.cache | ~/Library/Caches | $home/lib/cache | +| XDG_RUNTIME_DIR | /run/user/UID | ~/Library/Application Support | /tmp | +| XDG_BIN_HOME | ~/.local/bin | ~/.local/bin | $home/bin | diff --git a/paths_darwin.go b/paths_darwin.go index 2d9d60c..3b3d05f 100644 --- a/paths_darwin.go +++ b/paths_darwin.go @@ -18,12 +18,16 @@ func initBaseDirs(home string) { // Initialize standard directories. baseDirs.dataHome = pathutil.EnvPath(envDataHome, homeAppSupport) - baseDirs.data = pathutil.EnvPathList(envDataDirs, rootAppSupport) + baseDirs.data = pathutil.EnvPathList(envDataDirs, + rootAppSupport, + filepath.Join(home, ".local", "share"), + ) baseDirs.configHome = pathutil.EnvPath(envConfigHome, homeAppSupport) baseDirs.config = pathutil.EnvPathList(envConfigDirs, filepath.Join(home, "Library", "Preferences"), rootAppSupport, "/Library/Preferences", + filepath.Join(home, ".config"), ) baseDirs.stateHome = pathutil.EnvPath(envStateHome, homeAppSupport) baseDirs.cacheHome = pathutil.EnvPath(envCacheHome, filepath.Join(home, "Library", "Caches")) diff --git a/paths_darwin_test.go b/paths_darwin_test.go index 95b1222..6be5046 100644 --- a/paths_darwin_test.go +++ b/paths_darwin_test.go @@ -23,9 +23,12 @@ func TestDefaultBaseDirs(t *testing.T) { actual: &xdg.DataHome, }, &envSample{ - name: "XDG_DATA_DIRS", - expected: []string{rootAppSupport}, - actual: &xdg.DataDirs, + name: "XDG_DATA_DIRS", + expected: []string{ + rootAppSupport, + filepath.Join(home, ".local", "share"), + }, + actual: &xdg.DataDirs, }, &envSample{ name: "XDG_CONFIG_HOME", @@ -38,6 +41,7 @@ func TestDefaultBaseDirs(t *testing.T) { filepath.Join(home, "Library", "Preferences"), rootAppSupport, "/Library/Preferences", + filepath.Join(home, ".config"), }, actual: &xdg.ConfigDirs, },