From 3167dc268540b87ee9f6362f402b440a0360907f Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Wed, 3 Mar 2021 13:37:10 +0200 Subject: [PATCH 1/8] Add Plan 9 paths --- paths_plan9.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 paths_plan9.go diff --git a/paths_plan9.go b/paths_plan9.go new file mode 100644 index 0000000..05638af --- /dev/null +++ b/paths_plan9.go @@ -0,0 +1,44 @@ +// +build plan9 + +package xdg + +import ( + "path/filepath" +) + +func initBaseDirs(home string) { + homeLibDir := filepath.Join(home, "lib") + rootLibDir := "/lib" + + // Initialize base directories. + baseDirs.dataHome = xdgPath(envDataHome, homeLibDir) + baseDirs.data = xdgPaths(envDataDirs, rootLibDir) + baseDirs.configHome = xdgPath(envConfigHome, homeLibDir) + baseDirs.config = xdgPaths(envConfigDirs, rootLibDir) + baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(homeLibDir, "cache")) + baseDirs.runtime = xdgPath(envRuntimeDir, "/tmp") + + // Initialize non-standard directories. + baseDirs.stateHome = xdgPath(envStateHome, filepath.Join(homeLibDir, "state")) + + baseDirs.applications = []string{ + filepath.Join(home, "bin"), + "/bin", + } + + baseDirs.fonts = []string{ + filepath.Join(homeLibDir, "font"), + "/lib/font", + } +} + +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, "videos")) + UserDirs.Templates = xdgPath(envTemplatesDir, filepath.Join(home, "templates")) + UserDirs.PublicShare = xdgPath(envPublicShareDir, filepath.Join(home, "public")) +} From d69cdb68c29bbf241ea80eca2d93bd32aa8697db Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Wed, 3 Mar 2021 15:05:11 +0200 Subject: [PATCH 2/8] Add Plan 9 paths test cases --- paths_plan9_test.go | 219 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 paths_plan9_test.go diff --git a/paths_plan9_test.go b/paths_plan9_test.go new file mode 100644 index 0000000..5277b88 --- /dev/null +++ b/paths_plan9_test.go @@ -0,0 +1,219 @@ +// +build plan9 + +package xdg_test + +import ( + "path/filepath" + "testing" + + "github.com/adrg/xdg" +) + +func TestDefaultBaseDirs(t *testing.T) { + home := xdg.Home + + testDirs(t, + &envSample{ + name: "XDG_DATA_HOME", + expected: filepath.Join(home, "lib"), + actual: &xdg.DataHome, + }, + &envSample{ + name: "XDG_DATA_DIRS", + expected: []string{"/lib"}, + actual: &xdg.DataDirs, + }, + &envSample{ + name: "XDG_CONFIG_HOME", + expected: filepath.Join(home, "lib"), + actual: &xdg.ConfigHome, + }, + &envSample{ + name: "XDG_CONFIG_DIRS", + expected: []string{"/lib"}, + actual: &xdg.ConfigDirs, + }, + &envSample{ + name: "XDG_CACHE_HOME", + expected: filepath.Join(home, "lib", ".cache"), + actual: &xdg.CacheHome, + }, + &envSample{ + name: "XDG_RUNTIME_DIR", + expected: "/tmp", + actual: &xdg.RuntimeDir, + }, + &envSample{ + name: "XDG_STATE_HOME", + expected: filepath.Join(home, "lib", "state"), + actual: &xdg.StateHome, + }, + &envSample{ + name: "XDG_APPLICATION_DIRS", + expected: []string{ + filepath.Join(home, "bin"), + "/bin", + }, + actual: &xdg.ApplicationDirs, + }, + &envSample{ + name: "XDG_FONT_DIRS", + expected: []string{ + filepath.Join(home, "lib", "font"), + "/lib/font", + }, + actual: &xdg.FontDirs, + }, + ) +} + +func TestCustomBaseDirs(t *testing.T) { + home := xdg.Home + + testDirs(t, + &envSample{ + name: "XDG_DATA_HOME", + value: "$home/lib/data", + expected: filepath.Join(home, "lib", "data"), + actual: &xdg.DataHome, + }, + &envSample{ + name: "XDG_DATA_DIRS", + value: "/lib/data", + expected: []string{"/lib/data"}, + actual: &xdg.DataDirs, + }, + &envSample{ + name: "XDG_CONFIG_HOME", + value: "$home/lib/config", + expected: filepath.Join(home, "lib", "config"), + actual: &xdg.ConfigHome, + }, + &envSample{ + name: "XDG_CONFIG_DIRS", + value: "/lib/config", + expected: []string{"/lib/config"}, + actual: &xdg.ConfigDirs, + }, + &envSample{ + name: "XDG_CACHE_HOME", + value: "$home/lib", + expected: filepath.Join(home, "lib"), + actual: &xdg.CacheHome, + }, + &envSample{ + name: "XDG_RUNTIME_DIR", + value: "$home/lib/runtime", + expected: filepath.Join(home, "lib", "runtime"), + actual: &xdg.RuntimeDir, + }, + &envSample{ + name: "XDG_STATE_HOME", + value: "$home/lib", + expected: filepath.Join(home, "lib"), + actual: &xdg.StateHome, + }, + ) +} + +func TestDefaultUserDirs(t *testing.T) { + home := xdg.Home + + testDirs(t, + &envSample{ + name: "XDG_DESKTOP_DIR", + expected: filepath.Join(home, "desktop"), + actual: &xdg.UserDirs.Desktop, + }, + &envSample{ + name: "XDG_DOWNLOAD_DIR", + expected: filepath.Join(home, "downloads"), + actual: &xdg.UserDirs.Download, + }, + &envSample{ + name: "XDG_DOCUMENTS_DIR", + expected: filepath.Join(home, "documents"), + actual: &xdg.UserDirs.Documents, + }, + &envSample{ + name: "XDG_MUSIC_DIR", + expected: filepath.Join(home, "music"), + actual: &xdg.UserDirs.Music, + }, + &envSample{ + name: "XDG_PICTURES_DIR", + expected: filepath.Join(home, "pictures"), + actual: &xdg.UserDirs.Pictures, + }, + &envSample{ + name: "XDG_VIDEOS_DIR", + expected: filepath.Join(home, "videos"), + actual: &xdg.UserDirs.Videos, + }, + &envSample{ + name: "XDG_TEMPLATES_DIR", + expected: filepath.Join(home, "templates"), + actual: &xdg.UserDirs.Templates, + }, + &envSample{ + name: "XDG_PUBLICSHARE_DIR", + expected: filepath.Join(home, "public"), + actual: &xdg.UserDirs.PublicShare, + }, + ) +} + +func TestCustomUserDirs(t *testing.T) { + home := xdg.Home + + testDirs(t, + &envSample{ + name: "XDG_DESKTOP_DIR", + value: "$home/lib/desktop", + expected: filepath.Join(home, "lib", "desktop"), + actual: &xdg.UserDirs.Desktop, + }, + &envSample{ + name: "XDG_DOWNLOAD_DIR", + value: "$home/lib/downloads", + expected: filepath.Join(home, "lib", "downloads"), + actual: &xdg.UserDirs.Download, + }, + &envSample{ + name: "XDG_DOCUMENTS_DIR", + value: "$home/lib/documents", + expected: filepath.Join(home, "lib", "documents"), + actual: &xdg.UserDirs.Documents, + }, + &envSample{ + name: "XDG_MUSIC_DIR", + value: "$home/lib/music", + expected: filepath.Join(home, "lib", "music"), + actual: &xdg.UserDirs.Music, + }, + &envSample{ + name: "XDG_PICTURES_DIR", + value: "$home/lib/pictures", + expected: filepath.Join(home, "lib", "pictures"), + actual: &xdg.UserDirs.Pictures, + }, + &envSample{ + name: "XDG_VIDEOS_DIR", + value: "$home/lib/videos", + expected: filepath.Join(home, "lib", "videos"), + actual: &xdg.UserDirs.Videos, + }, + &envSample{ + name: "XDG_TEMPLATES_DIR", + value: "$home/lib/templates", + expected: filepath.Join(home, "lib", "templates"), + actual: &xdg.UserDirs.Templates, + }, + &envSample{ + name: "XDG_PUBLICSHARE_DIR", + value: "$home/lib/public", + expected: filepath.Join(home, "lib", "public"), + actual: &xdg.UserDirs.PublicShare, + }, + ) +} From bd31be1fbe1048b58f324a980ce23f70a8bf104e Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Wed, 3 Mar 2021 15:25:12 +0200 Subject: [PATCH 3/8] Add codecov.yml --- codecov.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..54ee338 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,11 @@ +coverage: + status: + project: + default: + target: 90% + threshold: 1% + patch: + default: + target: 100% +ignore: + - "paths_plan9.go" From 3224cc56410be883d18ad76dfa4bb1e021af1bb9 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Fri, 5 Mar 2021 11:53:54 +0200 Subject: [PATCH 4/8] Update CI Go version --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4b93df5..edce37a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: build: strategy: matrix: - go: ['1.14'] + go: ['1.16'] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: From 762acd287dc4ee80056f9978709dff616adb9223 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Fri, 5 Mar 2021 21:34:42 +0200 Subject: [PATCH 5/8] Update Plan 9 test cases --- paths_plan9_test.go | 58 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/paths_plan9_test.go b/paths_plan9_test.go index 5277b88..32aec86 100644 --- a/paths_plan9_test.go +++ b/paths_plan9_test.go @@ -35,7 +35,7 @@ func TestDefaultBaseDirs(t *testing.T) { }, &envSample{ name: "XDG_CACHE_HOME", - expected: filepath.Join(home, "lib", ".cache"), + expected: filepath.Join(home, "lib", "cache"), actual: &xdg.CacheHome, }, &envSample{ @@ -68,13 +68,13 @@ func TestDefaultBaseDirs(t *testing.T) { } func TestCustomBaseDirs(t *testing.T) { - home := xdg.Home + homeLib := filepath.Join(xdg.Home, "lib") testDirs(t, &envSample{ name: "XDG_DATA_HOME", - value: "$home/lib/data", - expected: filepath.Join(home, "lib", "data"), + value: filepath.Join(homeLib, "data"), + expected: filepath.Join(homeLib, "data"), actual: &xdg.DataHome, }, &envSample{ @@ -85,8 +85,8 @@ func TestCustomBaseDirs(t *testing.T) { }, &envSample{ name: "XDG_CONFIG_HOME", - value: "$home/lib/config", - expected: filepath.Join(home, "lib", "config"), + value: filepath.Join(homeLib, "config"), + expected: filepath.Join(homeLib, "config"), actual: &xdg.ConfigHome, }, &envSample{ @@ -97,20 +97,20 @@ func TestCustomBaseDirs(t *testing.T) { }, &envSample{ name: "XDG_CACHE_HOME", - value: "$home/lib", - expected: filepath.Join(home, "lib"), + value: homeLib, + expected: homeLib, actual: &xdg.CacheHome, }, &envSample{ name: "XDG_RUNTIME_DIR", - value: "$home/lib/runtime", - expected: filepath.Join(home, "lib", "runtime"), + value: filepath.Join(homeLib, "runtime"), + expected: filepath.Join(homeLib, "runtime"), actual: &xdg.RuntimeDir, }, &envSample{ name: "XDG_STATE_HOME", - value: "$home/lib", - expected: filepath.Join(home, "lib"), + value: homeLib, + expected: homeLib, actual: &xdg.StateHome, }, ) @@ -164,55 +164,55 @@ func TestDefaultUserDirs(t *testing.T) { } func TestCustomUserDirs(t *testing.T) { - home := xdg.Home + homeLib := filepath.Join(xdg.Home, "lib") testDirs(t, &envSample{ name: "XDG_DESKTOP_DIR", - value: "$home/lib/desktop", - expected: filepath.Join(home, "lib", "desktop"), + value: filepath.Join(homeLib, "desktop"), + expected: filepath.Join(homeLib, "desktop"), actual: &xdg.UserDirs.Desktop, }, &envSample{ name: "XDG_DOWNLOAD_DIR", - value: "$home/lib/downloads", - expected: filepath.Join(home, "lib", "downloads"), + value: filepath.Join(homeLib, "downloads"), + expected: filepath.Join(homeLib, "downloads"), actual: &xdg.UserDirs.Download, }, &envSample{ name: "XDG_DOCUMENTS_DIR", - value: "$home/lib/documents", - expected: filepath.Join(home, "lib", "documents"), + value: filepath.Join(homeLib, "documents"), + expected: filepath.Join(homeLib, "documents"), actual: &xdg.UserDirs.Documents, }, &envSample{ name: "XDG_MUSIC_DIR", - value: "$home/lib/music", - expected: filepath.Join(home, "lib", "music"), + value: filepath.Join(homeLib, "music"), + expected: filepath.Join(homeLib, "music"), actual: &xdg.UserDirs.Music, }, &envSample{ name: "XDG_PICTURES_DIR", - value: "$home/lib/pictures", - expected: filepath.Join(home, "lib", "pictures"), + value: filepath.Join(homeLib, "pictures"), + expected: filepath.Join(homeLib, "pictures"), actual: &xdg.UserDirs.Pictures, }, &envSample{ name: "XDG_VIDEOS_DIR", - value: "$home/lib/videos", - expected: filepath.Join(home, "lib", "videos"), + value: filepath.Join(homeLib, "videos"), + expected: filepath.Join(homeLib, "videos"), actual: &xdg.UserDirs.Videos, }, &envSample{ name: "XDG_TEMPLATES_DIR", - value: "$home/lib/templates", - expected: filepath.Join(home, "lib", "templates"), + value: filepath.Join(homeLib, "templates"), + expected: filepath.Join(homeLib, "templates"), actual: &xdg.UserDirs.Templates, }, &envSample{ name: "XDG_PUBLICSHARE_DIR", - value: "$home/lib/public", - expected: filepath.Join(home, "lib", "public"), + value: filepath.Join(homeLib, "public"), + expected: filepath.Join(homeLib, "public"), actual: &xdg.UserDirs.PublicShare, }, ) From 99a6f9bdf07f857432a43999fd8d1ecfe5b211e3 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Wed, 10 Mar 2021 16:32:17 +0200 Subject: [PATCH 6/8] Update README.md --- README.md | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index e4f4312..2916270 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ applications should use the XDG defined locations instead of hardcoding paths. The package also includes the locations of well known [user directories](https://wiki.archlinux.org/index.php/XDG_user_directories) and an implementation of the [state directory](https://wiki.debian.org/XDGBaseDirectorySpecification#Proposal:_STATE_directory) proposal. -Windows, macOS and most flavors of Unix are supported. +Most flavors of Unix, Windows, macOS and Plan 9 are supported. Full documentation can be found at: https://pkg.go.dev/github.com/adrg/xdg. @@ -58,27 +58,27 @@ present in the environment. #### XDG Base Directory -| | Unix | macOS | Windows | -| :-------------- | :---------------------------------- | :------------------------------------------------------------------------------------ | :-------------------------------------- | -| XDG_DATA_HOME | `~/.local/share` | `~/Library/Application Support` | `%LOCALAPPDATA%` | -| XDG_DATA_DIRS | `/usr/local/share`
`/usr/share` | `/Library/Application Support` | `%APPDATA%\Roaming`
`%PROGRAMDATA%` | -| XDG_CONFIG_HOME | `~/.config` | `~/Library/Application Support` | `%LOCALAPPDATA%` | -| XDG_CONFIG_DIRS | `/etc/xdg` | `~/Library/Preferences`
`/Library/Application Support`
`/Library/Preferences` | `%PROGRAMDATA%` | -| XDG_CACHE_HOME | `~/.cache` | `~/Library/Caches` | `%LOCALAPPDATA%\cache` | -| XDG_RUNTIME_DIR | `/run/user/UID` | `~/Library/Application Support` | `%LOCALAPPDATA%` | +| | Unix | macOS | Windows | Plan 9 | +| :--------------------------- | :---------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | -------------------------- | +| XDG_DATA_HOME | ~/.local/share | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | +| XDG_DATA_DIRS | /usr/local/share
/usr/share | /Library/Application Support | %APPDATA%\Roaming
%PROGRAMDATA% | /lib | +| XDG_CONFIG_HOME | ~/.config | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | +| XDG_CONFIG_DIRS | /etc/xdg | ~/Library/Preferences
/Library/Application Support
/Library/Preferences | %PROGRAMDATA% | /lib | +| XDG_CACHE_HOME | ~/.cache | ~/Library/Caches | %LOCALAPPDATA%\cache | $home/lib/cache | +| XDG_RUNTIME_DIR | /run/user/UID | ~/Library/Application Support | %LOCALAPPDATA% | /tmp | #### XDG user directories -| | Unix | macOS | Windows | -| :------------------ | :------------ | :------------ | :------------------------ | -| XDG_DESKTOP_DIR | `~/Desktop` | `~/Desktop` | `%USERPROFILE%/Desktop` | -| XDG_DOWNLOAD_DIR | `~/Downloads` | `~/Downloads` | `%USERPROFILE%/Downloads` | -| XDG_DOCUMENTS_DIR | `~/Documents` | `~/Documents` | `%USERPROFILE%/Documents` | -| XDG_MUSIC_DIR | `~/Music` | `~/Music` | `%USERPROFILE%/Music` | -| XDG_PICTURES_DIR | `~/Pictures` | `~/Pictures` | `%USERPROFILE%/Pictures` | -| XDG_VIDEOS_DIR | `~/Videos` | `~/Movies` | `%USERPROFILE%/Videos` | -| XDG_TEMPLATES_DIR | `~/Templates` | `~/Templates` | `%USERPROFILE%/Templates` | -| XDG_PUBLICSHARE_DIR | `~/Public` | `~/Public` | `%PUBLIC%` | +| | Unix | macOS | Windows | Plan 9 | +| :------------------------------- | :--------------------- | :--------------------- | :--------------------------------- | -------------------------- | +| XDG_DESKTOP_DIR | ~/Desktop | ~/Desktop | %USERPROFILE%\Desktop | $home/desktop | +| XDG_DOWNLOAD_DIR | ~/Downloads | ~/Downloads | %USERPROFILE%\Downloads | $home/downloads | +| XDG_DOCUMENTS_DIR | ~/Documents | ~/Documents | %USERPROFILE%\Documents | $home/documents | +| XDG_MUSIC_DIR | ~/Music | ~/Music | %USERPROFILE%\Music | $home/music | +| XDG_PICTURES_DIR | ~/Pictures | ~/Pictures | %USERPROFILE%\Pictures | $home/pictures | +| XDG_VIDEOS_DIR | ~/Videos | ~/Movies | %USERPROFILE%\Videos | $home/videos | +| XDG_TEMPLATES_DIR | ~/Templates | ~/Templates | %USERPROFILE%\Templates | $home/templates | +| XDG_PUBLICSHARE_DIR | ~/Public | ~/Public | %PUBLIC% | $home/public | #### Non-standard directories @@ -91,6 +91,8 @@ macOS • ~/Library/Application Support Windows • %LOCALAPPDATA% +Plan 9 + • $home/lib/state ``` Application directories @@ -106,6 +108,9 @@ macOS • /Applications Windows • %APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs +Plan 9 + • $home/bin + • /bin ``` Font directories @@ -126,6 +131,9 @@ macOS Windows • %windir%\Fonts • %LOCALAPPDATA%\Microsoft\Windows\Fonts +Plan 9 + • $home/lib/font + • /lib/font ``` ## Usage From 22e9ab2eb89167b32e16840f9edd28d32a67e8d0 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Wed, 10 Mar 2021 17:40:17 +0200 Subject: [PATCH 7/8] Update mon-standard directories README.md section --- README.md | 99 ++++++++++++++++++++----------------------------------- 1 file changed, 36 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 2916270..21613c2 100644 --- a/README.md +++ b/README.md @@ -58,83 +58,56 @@ present in the environment. #### XDG Base Directory -| | Unix | macOS | Windows | Plan 9 | -| :--------------------------- | :---------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | -------------------------- | -| XDG_DATA_HOME | ~/.local/share | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | -| XDG_DATA_DIRS | /usr/local/share
/usr/share | /Library/Application Support | %APPDATA%\Roaming
%PROGRAMDATA% | /lib | -| XDG_CONFIG_HOME | ~/.config | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | -| XDG_CONFIG_DIRS | /etc/xdg | ~/Library/Preferences
/Library/Application Support
/Library/Preferences | %PROGRAMDATA% | /lib | -| XDG_CACHE_HOME | ~/.cache | ~/Library/Caches | %LOCALAPPDATA%\cache | $home/lib/cache | -| XDG_RUNTIME_DIR | /run/user/UID | ~/Library/Application Support | %LOCALAPPDATA% | /tmp | +| | Unix | macOS | Windows | Plan 9 | +| :-------------- | :---------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | -------------------------- | +| XDG_DATA_HOME | ~/.local/share | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | +| XDG_DATA_DIRS | /usr/local/share
/usr/share | /Library/Application Support | %APPDATA%\Roaming
%PROGRAMDATA% | /lib | +| XDG_CONFIG_HOME | ~/.config | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | +| XDG_CONFIG_DIRS | /etc/xdg | ~/Library/Preferences
/Library/Application Support
/Library/Preferences | %PROGRAMDATA% | /lib | +| XDG_CACHE_HOME | ~/.cache | ~/Library/Caches | %LOCALAPPDATA%\cache | $home/lib/cache | +| XDG_RUNTIME_DIR | /run/user/UID | ~/Library/Application Support | %LOCALAPPDATA% | /tmp | #### XDG user directories -| | Unix | macOS | Windows | Plan 9 | -| :------------------------------- | :--------------------- | :--------------------- | :--------------------------------- | -------------------------- | -| XDG_DESKTOP_DIR | ~/Desktop | ~/Desktop | %USERPROFILE%\Desktop | $home/desktop | -| XDG_DOWNLOAD_DIR | ~/Downloads | ~/Downloads | %USERPROFILE%\Downloads | $home/downloads | -| XDG_DOCUMENTS_DIR | ~/Documents | ~/Documents | %USERPROFILE%\Documents | $home/documents | -| XDG_MUSIC_DIR | ~/Music | ~/Music | %USERPROFILE%\Music | $home/music | -| XDG_PICTURES_DIR | ~/Pictures | ~/Pictures | %USERPROFILE%\Pictures | $home/pictures | -| XDG_VIDEOS_DIR | ~/Videos | ~/Movies | %USERPROFILE%\Videos | $home/videos | -| XDG_TEMPLATES_DIR | ~/Templates | ~/Templates | %USERPROFILE%\Templates | $home/templates | -| XDG_PUBLICSHARE_DIR | ~/Public | ~/Public | %PUBLIC% | $home/public | +| | Unix | macOS | Windows | Plan 9 | +| :------------------ | :--------------------- | :--------------------- | :--------------------------------- | -------------------------- | +| XDG_DESKTOP_DIR | ~/Desktop | ~/Desktop | %USERPROFILE%\Desktop | $home/desktop | +| XDG_DOWNLOAD_DIR | ~/Downloads | ~/Downloads | %USERPROFILE%\Downloads | $home/downloads | +| XDG_DOCUMENTS_DIR | ~/Documents | ~/Documents | %USERPROFILE%\Documents | $home/documents | +| XDG_MUSIC_DIR | ~/Music | ~/Music | %USERPROFILE%\Music | $home/music | +| XDG_PICTURES_DIR | ~/Pictures | ~/Pictures | %USERPROFILE%\Pictures | $home/pictures | +| XDG_VIDEOS_DIR | ~/Videos | ~/Movies | %USERPROFILE%\Videos | $home/videos | +| XDG_TEMPLATES_DIR | ~/Templates | ~/Templates | %USERPROFILE%\Templates | $home/templates | +| XDG_PUBLICSHARE_DIR | ~/Public | ~/Public | %PUBLIC% | $home/public | #### Non-standard directories State directory -``` -Unix - • ~/.local/state -macOS - • ~/Library/Application Support -Windows - • %LOCALAPPDATA% -Plan 9 - • $home/lib/state -``` +| | Unix | macOS | Windows | Plan 9 | +| :------------- | :------------------------ | :--------------------------------------- | :------------------------ | :------------------------- | +| XDG_STATE_HOME | ~/.local/state | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib/state | Application directories -``` -Unix - • $XDG_DATA_HOME/applications - • ~/.local/share/applications - • /usr/local/share/applications - • /usr/share/applications - • $XDG_DATA_DIRS/applications -macOS - • /Applications -Windows - • %APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs -Plan 9 - • $home/bin - • /bin -``` +| Unix | macOS | Windows | Plan 9 | +| :--------------------------------------- | :----------------------- | :----------------------------------------------------------------- | :------------------------- | +| $XDG_DATA_HOME/applications | /Applications | %APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs | $home/bin | +| ~/.local/share/applications | | | /bin | +| /usr/local/share/applications | | | | +| /usr/share/applications | | | | +| $XDG_DATA_DIRS/applications | | | | Font directories -``` -Unix - • $XDG_DATA_HOME/fonts - • ~/.fonts - • ~/.local/share/fonts - • /usr/local/share/fonts - • /usr/share/fonts - • $XDG_DATA_DIRS/fonts -macOS - • ~/Library/Fonts - • /Library/Fonts - • /System/Library/Fonts - • /Network/Library/Fonts -Windows - • %windir%\Fonts - • %LOCALAPPDATA%\Microsoft\Windows\Fonts -Plan 9 - • $home/lib/font - • /lib/font -``` +| Unix | macOS | Windows | Plan 9 | +| :-------------------------------- | :-------------------------------- | :------------------------------------------------ | :------------------------ | +| $XDG_DATA_HOME/fonts | ~/Library/Fonts | %windir%\Fonts | $home/lib/font | +| ~/.fonts | /Library/Fonts | %LOCALAPPDATA%\Microsoft\Windows\Fonts | /lib/font | +| ~/.local/share/fonts | /System/Library/Fonts | | | +| /usr/local/share/fonts | /Network/Library/Fonts | | | +| /usr/share/fonts | | | | +| $XDG_DATA_DIRS/fonts | | | | ## Usage From 64bf6ff4670a4fd223a07dff3b1ec803cd1cd050 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Wed, 10 Mar 2021 21:55:14 +0200 Subject: [PATCH 8/8] Improve README.md --- README.md | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 21613c2..5a2ecb8 100644 --- a/README.md +++ b/README.md @@ -58,45 +58,45 @@ present in the environment. #### XDG Base Directory -| | Unix | macOS | Windows | Plan 9 | -| :-------------- | :---------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | -------------------------- | -| XDG_DATA_HOME | ~/.local/share | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | -| XDG_DATA_DIRS | /usr/local/share
/usr/share | /Library/Application Support | %APPDATA%\Roaming
%PROGRAMDATA% | /lib | -| XDG_CONFIG_HOME | ~/.config | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | -| XDG_CONFIG_DIRS | /etc/xdg | ~/Library/Preferences
/Library/Application Support
/Library/Preferences | %PROGRAMDATA% | /lib | -| XDG_CACHE_HOME | ~/.cache | ~/Library/Caches | %LOCALAPPDATA%\cache | $home/lib/cache | -| XDG_RUNTIME_DIR | /run/user/UID | ~/Library/Application Support | %LOCALAPPDATA% | /tmp | +| | Unix | macOS | Windows | Plan 9 | +| :--------------------------------------------- | :---------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | :------------------------- | +| XDG_DATA_HOME | ~/.local/share | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | +| XDG_DATA_DIRS | /usr/local/share
/usr/share | /Library/Application Support | %APPDATA%\Roaming
%PROGRAMDATA% | /lib | +| XDG_CONFIG_HOME | ~/.config | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib | +| XDG_CONFIG_DIRS | /etc/xdg | ~/Library/Preferences
/Library/Application Support
/Library/Preferences | %PROGRAMDATA% | /lib | +| XDG_CACHE_HOME | ~/.cache | ~/Library/Caches | %LOCALAPPDATA%\cache | $home/lib/cache | +| XDG_RUNTIME_DIR | /run/user/UID | ~/Library/Application Support | %LOCALAPPDATA% | /tmp | #### XDG user directories -| | Unix | macOS | Windows | Plan 9 | -| :------------------ | :--------------------- | :--------------------- | :--------------------------------- | -------------------------- | -| XDG_DESKTOP_DIR | ~/Desktop | ~/Desktop | %USERPROFILE%\Desktop | $home/desktop | -| XDG_DOWNLOAD_DIR | ~/Downloads | ~/Downloads | %USERPROFILE%\Downloads | $home/downloads | -| XDG_DOCUMENTS_DIR | ~/Documents | ~/Documents | %USERPROFILE%\Documents | $home/documents | -| XDG_MUSIC_DIR | ~/Music | ~/Music | %USERPROFILE%\Music | $home/music | -| XDG_PICTURES_DIR | ~/Pictures | ~/Pictures | %USERPROFILE%\Pictures | $home/pictures | -| XDG_VIDEOS_DIR | ~/Videos | ~/Movies | %USERPROFILE%\Videos | $home/videos | -| XDG_TEMPLATES_DIR | ~/Templates | ~/Templates | %USERPROFILE%\Templates | $home/templates | -| XDG_PUBLICSHARE_DIR | ~/Public | ~/Public | %PUBLIC% | $home/public | +| | Unix | macOS | Windows | Plan 9 | +| :------------------------------------------------- | :--------------------- | :--------------------- | :--------------------------------- | :------------------------- | +| XDG_DESKTOP_DIR | ~/Desktop | ~/Desktop | %USERPROFILE%\Desktop | $home/desktop | +| XDG_DOWNLOAD_DIR | ~/Downloads | ~/Downloads | %USERPROFILE%\Downloads | $home/downloads | +| XDG_DOCUMENTS_DIR | ~/Documents | ~/Documents | %USERPROFILE%\Documents | $home/documents | +| XDG_MUSIC_DIR | ~/Music | ~/Music | %USERPROFILE%\Music | $home/music | +| XDG_PICTURES_DIR | ~/Pictures | ~/Pictures | %USERPROFILE%\Pictures | $home/pictures | +| XDG_VIDEOS_DIR | ~/Videos | ~/Movies | %USERPROFILE%\Videos | $home/videos | +| XDG_TEMPLATES_DIR | ~/Templates | ~/Templates | %USERPROFILE%\Templates | $home/templates | +| XDG_PUBLICSHARE_DIR | ~/Public | ~/Public | %PUBLIC% | $home/public | #### Non-standard directories State directory -| | Unix | macOS | Windows | Plan 9 | -| :------------- | :------------------------ | :--------------------------------------- | :------------------------ | :------------------------- | -| XDG_STATE_HOME | ~/.local/state | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib/state | +| | Unix | macOS | Windows | Plan 9 | +| :-------------------------------------------- | :------------------------ | :--------------------------------------- | :------------------------ | :------------------------- | +| XDG_STATE_HOME | ~/.local/state | ~/Library/Application Support | %LOCALAPPDATA% | $home/lib/state | Application directories -| Unix | macOS | Windows | Plan 9 | -| :--------------------------------------- | :----------------------- | :----------------------------------------------------------------- | :------------------------- | -| $XDG_DATA_HOME/applications | /Applications | %APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs | $home/bin | -| ~/.local/share/applications | | | /bin | -| /usr/local/share/applications | | | | -| /usr/share/applications | | | | -| $XDG_DATA_DIRS/applications | | | | +| Unix | macOS | Windows | Plan 9 | +| :--------------------------------------- | :----------------------- | :----------------------------------------------------------------- | :-------------------- | +| $XDG_DATA_HOME/applications | /Applications | %APPDATA%\Roaming\Microsoft\Windows\Start Menu\Programs | $home/bin | +| ~/.local/share/applications | | | /bin | +| /usr/local/share/applications | | | | +| /usr/share/applications | | | | +| $XDG_DATA_DIRS/applications | | | | Font directories