{"id":13411216,"url":"https://github.com/adrg/xdg","last_synced_at":"2025-05-13T15:11:23.171Z","repository":{"id":19951484,"uuid":"23218292","full_name":"adrg/xdg","owner":"adrg","description":"Go implementation of the XDG Base Directory Specification and XDG user directories","archived":false,"fork":false,"pushed_at":"2025-04-08T10:20:31.000Z","size":282,"stargazers_count":801,"open_issues_count":7,"forks_count":30,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-23T18:56:53.272Z","etag":null,"topics":["cross-platform","go","golang","golang-library","golang-package","known-folders","library","linux","macos","plan9","specification","unix","windows","xdg","xdg-basedir","xdg-compliance","xdg-specs","xdg-user-dirs"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/adrg/xdg","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"ko_fi":"adrg"}},"created_at":"2014-08-22T08:23:40.000Z","updated_at":"2025-04-22T15:07:31.000Z","dependencies_parsed_at":"2024-01-08T14:30:53.001Z","dependency_job_id":"60241958-9305-432b-9463-706f0843d788","html_url":"https://github.com/adrg/xdg","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Fxdg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Fxdg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Fxdg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Fxdg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrg","download_url":"https://codeload.github.com/adrg/xdg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969259,"owners_count":21992263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cross-platform","go","golang","golang-library","golang-package","known-folders","library","linux","macos","plan9","specification","unix","windows","xdg","xdg-basedir","xdg-compliance","xdg-specs","xdg-user-dirs"],"created_at":"2024-07-30T20:01:12.229Z","updated_at":"2025-05-13T15:11:18.133Z","avatar_url":"https://github.com/adrg.png","language":"Go","readme":"\u003ch1 align=\"center\"\u003e\n  \u003cdiv\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/adrg/adrg.github.io/master/assets/projects/xdg/logo.svg\" alt=\"xdg logo\"/\u003e\n  \u003c/div\u003e\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eGo implementation of the XDG Base Directory Specification and XDG user directories.\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/adrg/xdg/actions/workflows/tests.yml\"\u003e\n        \u003cimg alt=\"Tests status\" src=\"https://github.com/adrg/xdg/actions/workflows/tests.yml/badge.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://app.codecov.io/gh/adrg/xdg\"\u003e\n        \u003cimg alt=\"Code coverage\" src=\"https://codecov.io/gh/adrg/xdg/branch/master/graphs/badge.svg?branch=master\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pkg.go.dev/github.com/adrg/xdg\"\u003e\n        \u003cimg alt=\"pkg.go.dev documentation\" src=\"https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\" rel=\"nofollow\"\u003e\n        \u003cimg alt=\"MIT license\" src=\"https://img.shields.io/github/license/adrg/xdg\"\u003e\n    \u003c/a\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://goreportcard.com/report/github.com/adrg/xdg\"\u003e\n        \u003cimg alt=\"Go report card\" src=\"https://goreportcard.com/badge/github.com/adrg/xdg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/avelino/awesome-go#configuration\"\u003e\n        \u003cimg alt=\"Awesome Go\" src=\"https://awesome.re/mentioned-badge.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/adrg/xdg/graphs/contributors\"\u003e\n        \u003cimg alt=\"GitHub contributors\" src=\"https://img.shields.io/github/contributors/adrg/xdg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/adrg/xdg/issues\"\u003e\n        \u003cimg alt=\"GitHub open issues\" src=\"https://img.shields.io/github/issues-raw/adrg/xdg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://ko-fi.com/T6T72WATK\"\u003e\n        \u003cimg alt=\"Buy me a coffee\" src=\"https://img.shields.io/static/v1.svg?label=%20\u0026message=Buy%20me%20a%20coffee\u0026color=579fbf\u0026logo=buy%20me%20a%20coffee\u0026logoColor=white\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nProvides an implementation of the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).\nThe specification defines a set of standard paths for storing application files,\nincluding data and configuration files. For portability and flexibility reasons,\napplications should use the XDG defined locations instead of hardcoding paths.\n\nThe package also includes the locations of well known [user directories](https://wiki.archlinux.org/index.php/XDG_user_directories),\nsupport for the non-standard `XDG_BIN_HOME` directory, as well as other common directories such as fonts and applications.\n\nThe current implementation supports **most flavors of Unix**, **Windows**, **macOS** and **Plan 9**.  \nOn Windows, where XDG environment variables are not usually set, the package uses [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/known-folders)\nas defaults. Therefore, appropriate locations are used for common [folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid) which may have been redirected.\n\nSee usage [examples](#usage) below. Full documentation can be found at https://pkg.go.dev/github.com/adrg/xdg.\n\n## Installation\n    go get github.com/adrg/xdg\n\n## Default locations\n\nThe package defines sensible defaults for XDG variables which are empty or not\npresent in the environment.\n\n- On Unix-like operating systems, XDG environment variables are typically defined.\nAppropriate default locations are used for the environment variables which are not set.\n- On Windows, XDG environment variables are usually not set. If that is the case,\nthe package relies on the appropriate [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid).\nSensible fallback locations are used for the folders which are not set.\n\n### XDG Base Directory\n\n\u003cdetails open\u003e\n    \u003csummary\u003e\u003cstrong\u003eUnix-like operating systems\u003c/strong\u003e\u003c/summary\u003e\n    \u003cbr/\u003e\n\n| \u003ca href=\"#xdg-base-directory\"\u003e\u003cimg width=\"400\" height=\"0\"\u003e\u003c/a\u003e | \u003ca href=\"#xdg-base-directory\"\u003e\u003cimg width=\"500\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003eUnix\u003c/p\u003e | \u003ca href=\"#xdg-base-directory\"\u003e\u003cimg width=\"600\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003emacOS\u003c/p\u003e                                                                          | \u003ca href=\"#xdg-base-directory\"\u003e\u003cimg width=\"500\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003ePlan 9\u003c/p\u003e |\n| :------------------------------------------------------------: | :-----------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------: |\n| \u003ckbd\u003e\u003cb\u003eXDG_DATA_HOME\u003c/b\u003e\u003c/kbd\u003e                                | \u003ckbd\u003e~/.local/share\u003c/kbd\u003e                                                 | \u003ckbd\u003e~/Library/Application\u0026nbsp;Support\u003c/kbd\u003e                                                                                                       | \u003ckbd\u003e$home/lib\u003c/kbd\u003e                                                        |\n| \u003ckbd\u003e\u003cb\u003eXDG_DATA_DIRS\u003c/b\u003e\u003c/kbd\u003e                                | \u003ckbd\u003e/usr/local/share\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/usr/share\u003c/kbd\u003e                     | \u003ckbd\u003e/Library/Application\u0026nbsp;Support\u003c/kbd\u003e\u003ckbd\u003e~/.local/share\u003c/kbd\u003e                                                                               | \u003ckbd\u003e/lib\u003c/kbd\u003e                                                             |\n| \u003ckbd\u003e\u003cb\u003eXDG_CONFIG_HOME\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003e~/.config\u003c/kbd\u003e                                                      | \u003ckbd\u003e~/Library/Application\u0026nbsp;Support\u003c/kbd\u003e                                                                                                       | \u003ckbd\u003e$home/lib\u003c/kbd\u003e                                                        |\n| \u003ckbd\u003e\u003cb\u003eXDG_CONFIG_DIRS\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003e/etc/xdg\u003c/kbd\u003e                                                       | \u003ckbd\u003e~/Library/Preferences\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/Library/Application\u0026nbsp;Support\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/Library/Preferences\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e\u0026#126;/.config\u003c/kbd\u003e | \u003ckbd\u003e/lib\u003c/kbd\u003e                                                             |\n| \u003ckbd\u003e\u003cb\u003eXDG_STATE_HOME\u003c/b\u003e\u003c/kbd\u003e                               | \u003ckbd\u003e~/.local/state\u003c/kbd\u003e                                                 | \u003ckbd\u003e~/Library/Application\u0026nbsp;Support\u003c/kbd\u003e                                                                                                       | \u003ckbd\u003e$home/lib/state\u003c/kbd\u003e                                                  |\n| \u003ckbd\u003e\u003cb\u003eXDG_CACHE_HOME\u003c/b\u003e\u003c/kbd\u003e                               | \u003ckbd\u003e~/.cache\u003c/kbd\u003e                                                       | \u003ckbd\u003e~/Library/Caches\u003c/kbd\u003e                                                                                                                         | \u003ckbd\u003e$home/lib/cache\u003c/kbd\u003e                                                  |\n| \u003ckbd\u003e\u003cb\u003eXDG_RUNTIME_DIR\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003e/run/user/$UID\u003c/kbd\u003e                                                 | \u003ckbd\u003e~/Library/Application\u0026nbsp;Support\u003c/kbd\u003e                                                                                                       | \u003ckbd\u003e/tmp\u003c/kbd\u003e                                                             |\n| \u003ckbd\u003e\u003cb\u003eXDG_BIN_HOME\u003c/b\u003e\u003c/kbd\u003e                                 | \u003ckbd\u003e~/.local/bin\u003c/kbd\u003e                                                   | \u003ckbd\u003e~/.local/bin\u003c/kbd\u003e                                                                                                                             | \u003ckbd\u003e$home/bin\u003c/kbd\u003e                                                        |\n\n\u003c/details\u003e\n\n\u003cdetails open\u003e\n    \u003csummary\u003e\u003cstrong\u003eMicrosoft Windows\u003c/strong\u003e\u003c/summary\u003e\n    \u003cbr/\u003e\n\n| \u003ca href=\"#xdg-base-directory\"\u003e\u003cimg width=\"400\" height=\"0\"\u003e\u003c/a\u003e | \u003ca href=\"#xdg-base-directory\"\u003e\u003cimg width=\"700\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003eKnown\u0026nbsp;Folder(s)\u003c/p\u003e | \u003ca href=\"#xdg-base-directory\"\u003e\u003cimg width=\"900\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003eFallback(s)\u003c/p\u003e |\n| :------------------------------------------------------------: | :---------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------: |\n| \u003ckbd\u003e\u003cb\u003eXDG_DATA_HOME\u003c/b\u003e\u003c/kbd\u003e                                | \u003ckbd\u003eLocalAppData\u003c/kbd\u003e                                                                   | \u003ckbd\u003e%LOCALAPPDATA%\u003c/kbd\u003e                                                        |\n| \u003ckbd\u003e\u003cb\u003eXDG_DATA_DIRS\u003c/b\u003e\u003c/kbd\u003e                                | \u003ckbd\u003eRoamingAppData\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003eProgramData\u003c/kbd\u003e                                      | \u003ckbd\u003e%APPADATA%\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e%ProgramData%\u003c/kbd\u003e                               |\n| \u003ckbd\u003e\u003cb\u003eXDG_CONFIG_HOME\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003eLocalAppData\u003c/kbd\u003e                                                                   | \u003ckbd\u003e%LOCALAPPDATA%\u003c/kbd\u003e                                                        |\n| \u003ckbd\u003e\u003cb\u003eXDG_CONFIG_DIRS\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003eProgramData\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003eRoamingAppData\u003c/kbd\u003e                                      | \u003ckbd\u003e%ProgramData%\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e%APPDATA%\u003c/kbd\u003e                                |\n| \u003ckbd\u003e\u003cb\u003eXDG_STATE_HOME\u003c/b\u003e\u003c/kbd\u003e                               | \u003ckbd\u003eLocalAppData\u003c/kbd\u003e                                                                   | \u003ckbd\u003e%LOCALAPPDATA%\u003c/kbd\u003e                                                        |\n| \u003ckbd\u003e\u003cb\u003eXDG_CACHE_HOME\u003c/b\u003e\u003c/kbd\u003e                               | \u003ckbd\u003eLocalAppData\\cache\u003c/kbd\u003e                                                             | \u003ckbd\u003e%LOCALAPPDATA%\\cache\u003c/kbd\u003e                                                  |\n| \u003ckbd\u003e\u003cb\u003eXDG_RUNTIME_DIR\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003eLocalAppData\u003c/kbd\u003e                                                                   | \u003ckbd\u003e%LOCALAPPDATA%\u003c/kbd\u003e                                                        |\n| \u003ckbd\u003e\u003cb\u003eXDG_BIN_HOME\u003c/b\u003e\u003c/kbd\u003e                                 | \u003ckbd\u003eUserProgramFiles\u003c/kbd\u003e                                                               | \u003ckbd\u003e%LOCALAPPDATA%\\Programs\u003c/kbd\u003e                                               |\n\n\u003c/details\u003e\n\n### XDG user directories\n\nXDG user directories environment variables are usually **not** set on most\noperating systems. However, if they are present in the environment, they take\nprecedence. Appropriate fallback locations are used for the environment\nvariables which are not set.\n\n- On Unix-like operating systems (except macOS and Plan 9), the package reads the [user-dirs.dirs](https://man.archlinux.org/man/user-dirs.dirs.5.en) config file.\n- On Windows, the package uses the appropriate [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid).\n\nLastly, default locations are used for any user directories which are not set,\nas shown in the following tables.\n\n\u003cdetails open\u003e\n    \u003csummary\u003e\u003cstrong\u003eUnix-like operating systems\u003c/strong\u003e\u003c/summary\u003e\n    \u003cbr/\u003e\n\n| \u003ca href=\"#xdg-user-directories\"\u003e\u003cimg width=\"500\" height=\"0\"\u003e\u003c/a\u003e | \u003ca href=\"#xdg-user-directories\"\u003e\u003cimg width=\"500\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003eUnix\u003c/p\u003e | \u003ca href=\"#xdg-user-directories\"\u003e\u003cimg width=\"500\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003emacOS\u003c/p\u003e  | \u003ca href=\"#xdg-user-directories\"\u003e\u003cimg width=\"500\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003ePlan 9\u003c/p\u003e |\n| :--------------------------------------------------------------: | :-------------------------------------------------------------------------: | :---------------------------------------------------------------------------: | :---------------------------------------------------------------------------: |\n| \u003ckbd\u003e\u003cb\u003eXDG_DESKTOP_DIR\u003c/b\u003e\u003c/kbd\u003e                                | \u003ckbd\u003e~/Desktop\u003c/kbd\u003e                                                        | \u003ckbd\u003e~/Desktop\u003c/kbd\u003e                                                          | \u003ckbd\u003e$home/desktop\u003c/kbd\u003e                                                      |\n| \u003ckbd\u003e\u003cb\u003eXDG_DOWNLOAD_DIR\u003c/b\u003e\u003c/kbd\u003e                               | \u003ckbd\u003e~/Downloads\u003c/kbd\u003e                                                      | \u003ckbd\u003e~/Downloads\u003c/kbd\u003e                                                        | \u003ckbd\u003e$home/downloads\u003c/kbd\u003e                                                    |\n| \u003ckbd\u003e\u003cb\u003eXDG_DOCUMENTS_DIR\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003e~/Documents\u003c/kbd\u003e                                                      | \u003ckbd\u003e~/Documents\u003c/kbd\u003e                                                        | \u003ckbd\u003e$home/documents\u003c/kbd\u003e                                                    |\n| \u003ckbd\u003e\u003cb\u003eXDG_MUSIC_DIR\u003c/b\u003e\u003c/kbd\u003e                                  | \u003ckbd\u003e~/Music\u003c/kbd\u003e                                                          | \u003ckbd\u003e~/Music\u003c/kbd\u003e                                                            | \u003ckbd\u003e$home/music\u003c/kbd\u003e                                                        |\n| \u003ckbd\u003e\u003cb\u003eXDG_PICTURES_DIR\u003c/b\u003e\u003c/kbd\u003e                               | \u003ckbd\u003e~/Pictures\u003c/kbd\u003e                                                       | \u003ckbd\u003e~/Pictures\u003c/kbd\u003e                                                         | \u003ckbd\u003e$home/pictures\u003c/kbd\u003e                                                     |\n| \u003ckbd\u003e\u003cb\u003eXDG_VIDEOS_DIR\u003c/b\u003e\u003c/kbd\u003e                                 | \u003ckbd\u003e~/Videos\u003c/kbd\u003e                                                         | \u003ckbd\u003e~/Movies\u003c/kbd\u003e                                                           | \u003ckbd\u003e$home/videos\u003c/kbd\u003e                                                       |\n| \u003ckbd\u003e\u003cb\u003eXDG_TEMPLATES_DIR\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003e~/Templates\u003c/kbd\u003e                                                      | \u003ckbd\u003e~/Templates\u003c/kbd\u003e                                                        | \u003ckbd\u003e$home/templates\u003c/kbd\u003e                                                    |\n| \u003ckbd\u003e\u003cb\u003eXDG_PUBLICSHARE_DIR\u003c/b\u003e\u003c/kbd\u003e                            | \u003ckbd\u003e~/Public\u003c/kbd\u003e                                                         | \u003ckbd\u003e~/Public\u003c/kbd\u003e                                                           | \u003ckbd\u003e$home/public\u003c/kbd\u003e                                                       |\n\n\u003c/details\u003e\n\n\u003cdetails open\u003e\n    \u003csummary\u003e\u003cstrong\u003eMicrosoft Windows\u003c/strong\u003e\u003c/summary\u003e\n    \u003cbr/\u003e\n\n| \u003ca href=\"#xdg-user-directories\"\u003e\u003cimg width=\"500\" height=\"0\"\u003e\u003c/a\u003e | \u003ca href=\"#xdg-user-directories\"\u003e\u003cimg width=\"600\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003eKnown\u0026nbsp;Folder(s)\u003c/p\u003e | \u003ca href=\"#xdg-user-directories\"\u003e\u003cimg width=\"900\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003eFallback(s)\u003c/p\u003e |\n| :--------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------: |\n| \u003ckbd\u003e\u003cb\u003eXDG_DESKTOP_DIR\u003c/b\u003e\u003c/kbd\u003e                                | \u003ckbd\u003eDesktop\u003c/kbd\u003e                                                                          | \u003ckbd\u003e%USERPROFILE%\\Desktop\u003c/kbd\u003e                                                   |\n| \u003ckbd\u003e\u003cb\u003eXDG_DOWNLOAD_DIR\u003c/b\u003e\u003c/kbd\u003e                               | \u003ckbd\u003eDownloads\u003c/kbd\u003e                                                                        | \u003ckbd\u003e%USERPROFILE%\\Downloads\u003c/kbd\u003e                                                 |\n| \u003ckbd\u003e\u003cb\u003eXDG_DOCUMENTS_DIR\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003eDocuments\u003c/kbd\u003e                                                                        | \u003ckbd\u003e%USERPROFILE%\\Documents\u003c/kbd\u003e                                                 |\n| \u003ckbd\u003e\u003cb\u003eXDG_MUSIC_DIR\u003c/b\u003e\u003c/kbd\u003e                                  | \u003ckbd\u003eMusic\u003c/kbd\u003e                                                                            | \u003ckbd\u003e%USERPROFILE%\\Music\u003c/kbd\u003e                                                     |\n| \u003ckbd\u003e\u003cb\u003eXDG_PICTURES_DIR\u003c/b\u003e\u003c/kbd\u003e                               | \u003ckbd\u003ePictures\u003c/kbd\u003e                                                                         | \u003ckbd\u003e%USERPROFILE%\\Pictures\u003c/kbd\u003e                                                  |\n| \u003ckbd\u003e\u003cb\u003eXDG_VIDEOS_DIR\u003c/b\u003e\u003c/kbd\u003e                                 | \u003ckbd\u003eVideos\u003c/kbd\u003e                                                                           | \u003ckbd\u003e%USERPROFILE%\\Videos\u003c/kbd\u003e                                                    |\n| \u003ckbd\u003e\u003cb\u003eXDG_TEMPLATES_DIR\u003c/b\u003e\u003c/kbd\u003e                              | \u003ckbd\u003eTemplates\u003c/kbd\u003e                                                                        | \u003ckbd\u003e%APPDATA%\\Microsoft\\Windows\\Templates\u003c/kbd\u003e                                   |\n| \u003ckbd\u003e\u003cb\u003eXDG_PUBLICSHARE_DIR\u003c/b\u003e\u003c/kbd\u003e                            | \u003ckbd\u003ePublic\u003c/kbd\u003e                                                                           | \u003ckbd\u003e%PUBLIC%\u003c/kbd\u003e                                                                |\n\n\u003c/details\u003e\n\n### Other directories\n\n\u003cdetails open\u003e\n    \u003csummary\u003e\u003cstrong\u003eUnix-like operating systems\u003c/strong\u003e\u003c/summary\u003e\n    \u003cbr/\u003e\n\n| \u003ca href=\"#other-directories\"\u003e\u003cimg width=\"400\" height=\"0\"\u003e\u003c/a\u003e | \u003ca href=\"#other-directories\"\u003e\u003cimg width=\"600\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003eUnix\u003c/p\u003e                                                                                                                                         | \u003ca href=\"#other-directories\"\u003e\u003cimg width=\"600\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003emacOS\u003c/p\u003e                                                           | \u003ca href=\"#other-directories\"\u003e\u003cimg width=\"400\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003ePlan 9\u003c/p\u003e |\n| :-----------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------: |\n| \u003ckbd\u003e\u003cb\u003eHome\u003c/b\u003e\u003c/kbd\u003e                                        | \u003ckbd\u003e$HOME\u003c/kbd\u003e                                                                                                                                                                                                 | \u003ckbd\u003e$HOME\u003c/kbd\u003e                                                                                                                    | \u003ckbd\u003e$home\u003c/kbd\u003e                                                           |\n| \u003ckbd\u003e\u003cb\u003eApplications\u003c/b\u003e\u003c/kbd\u003e                                | \u003ckbd\u003e$XDG_DATA_HOME/applications\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e~/.local/share/applications\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/usr/local/share/applications\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/usr/share/applications\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e$XDG_DATA_DIRS/applications\u003c/kbd\u003e | \u003ckbd\u003e/Applications\u003c/kbd\u003e                                                                                                            | \u003ckbd\u003e$home/bin\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/bin\u003c/kbd\u003e                                   |\n| \u003ckbd\u003e\u003cb\u003eFonts\u003c/b\u003e\u003c/kbd\u003e                                       | \u003ckbd\u003e$XDG_DATA_HOME/fonts\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e\u0026#126;/.fonts\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e~/.local/share/fonts\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/usr/local/share/fonts\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/usr/share/fonts\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e$XDG_DATA_DIRS/fonts\u003c/kbd\u003e       | \u003ckbd\u003e~/Library/Fonts\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/Library/Fonts\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/System/Library/Fonts\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/Network/Library/Fonts\u003c/kbd\u003e | \u003ckbd\u003e$home/lib/font\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e/lib/font\u003c/kbd\u003e                         |\n\n\u003c/details\u003e\n\n\u003cdetails open\u003e\n    \u003csummary\u003e\u003cstrong\u003eMicrosoft Windows\u003c/strong\u003e\u003c/summary\u003e\n    \u003cbr/\u003e\n\n| \u003ca href=\"#other-directories\"\u003e\u003cimg width=\"400\" height=\"0\"\u003e\u003c/a\u003e | \u003ca href=\"#other-directories\"\u003e\u003cimg width=\"300\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003eKnown\u0026nbsp;Folder(s)\u003c/p\u003e                                                                                               | \u003ca href=\"#other-directories\"\u003e\u003cimg width=\"1300\" height=\"0\"\u003e\u003c/a\u003e\u003cp\u003eFallback(s)\u003c/p\u003e                                                                                                                                                                                                                     |\n| :-----------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |\n| \u003ckbd\u003e\u003cb\u003eHome\u003c/b\u003e\u003c/kbd\u003e                                        | \u003ckbd\u003eProfile\u003c/kbd\u003e                                                                                                                                                                     | \u003ckbd\u003e%USERPROFILE%\u003c/kbd\u003e                                                                                                                                                                                                                                                                             |\n| \u003ckbd\u003e\u003cb\u003eApplications\u003c/b\u003e\u003c/kbd\u003e                                | \u003ckbd\u003ePrograms\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003eCommonPrograms\u003c/kbd\u003e \u003cbr/\u003e\u003ckbd\u003eProgramFiles\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003eProgramFilesCommon\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003eUserProgramFiles\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003eUserProgramFilesCommon\u003c/kbd\u003e | \u003ckbd\u003e%APPDATA%\\Microsoft\\Windows\\Start\u0026nbsp;Menu\\Programs\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e%ProgramData%\\Microsoft\\Windows\\Start\u0026nbsp;Menu\\Programs\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e%ProgramFiles%\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e%ProgramFiles%\\Common Files\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e%LOCALAPPDATA%\\Programs\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e%LOCALAPPDATA%\\Programs\\Common\u003c/kbd\u003e|\n| \u003ckbd\u003e\u003cb\u003eFonts\u003c/b\u003e\u003c/kbd\u003e                                       | \u003ckbd\u003eFonts\u003c/kbd\u003e                                                                                                                                                                       | \u003ckbd\u003e%SystemRoot%\\Fonts\u003c/kbd\u003e\u003cbr/\u003e\u003ckbd\u003e%LOCALAPPDATA%\\Microsoft\\Windows\\Fonts\u003c/kbd\u003e                                                                                                                                                                                                                  |\n\n\u003c/details\u003e\n\n## Usage\n\n#### XDG Base Directory\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/adrg/xdg\"\n)\n\nfunc main() {\n\t// XDG Base Directory paths.\n\tlog.Println(\"Home data directory:\", xdg.DataHome)\n\tlog.Println(\"Data directories:\", xdg.DataDirs)\n\tlog.Println(\"Home config directory:\", xdg.ConfigHome)\n\tlog.Println(\"Config directories:\", xdg.ConfigDirs)\n\tlog.Println(\"Home state directory:\", xdg.StateHome)\n\tlog.Println(\"Cache directory:\", xdg.CacheHome)\n\tlog.Println(\"Runtime directory:\", xdg.RuntimeDir)\n\tlog.Println(\"Home binaries directory:\", xdg.BinHome)\n\n\t// Other common directories.\n\tlog.Println(\"Home directory:\", xdg.Home)\n\tlog.Println(\"Application directories:\", xdg.ApplicationDirs)\n\tlog.Println(\"Font directories:\", xdg.FontDirs)\n\n\t// Obtain a suitable location for application config files.\n\t// ConfigFile takes one parameter which must contain the name of the file,\n\t// but it can also contain a set of parent directories. If the directories\n\t// don't exist, they will be created relative to the base config directory.\n\t// It is recommended for files to be saved inside an application directory\n\t// relative to the base directory rather than directly inside the base\n\t// directory (e.g. `appname/config.yaml` instead of `appname-config.yaml`).\n\tconfigFilePath, err := xdg.ConfigFile(\"appname/config.yaml\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Println(\"Save the config file at:\", configFilePath)\n\n\t// For other types of application files use:\n\t// xdg.DataFile()\n\t// xdg.StateFile()\n\t// xdg.CacheFile()\n\t// xdg.RuntimeFile()\n\n\t// Finding application config files.\n\t// SearchConfigFile takes one parameter which must contain the name of\n\t// the file, but it can also contain a set of parent directories relative\n\t// to the config search paths (xdg.ConfigHome and xdg.ConfigDirs).\n\tconfigFilePath, err = xdg.SearchConfigFile(\"appname/config.yaml\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Println(\"Config file was found at:\", configFilePath)\n\n\t// For other types of application files use:\n\t// xdg.SearchDataFile()\n\t// xdg.SearchStateFile()\n\t// xdg.SearchCacheFile()\n\t// xdg.SearchRuntimeFile()\n}\n```\n\n#### XDG user directories\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/adrg/xdg\"\n)\n\nfunc main() {\n\t// XDG user directories.\n\tlog.Println(\"Desktop directory:\", xdg.UserDirs.Desktop)\n\tlog.Println(\"Download directory:\", xdg.UserDirs.Download)\n\tlog.Println(\"Documents directory:\", xdg.UserDirs.Documents)\n\tlog.Println(\"Music directory:\", xdg.UserDirs.Music)\n\tlog.Println(\"Pictures directory:\", xdg.UserDirs.Pictures)\n\tlog.Println(\"Videos directory:\", xdg.UserDirs.Videos)\n\tlog.Println(\"Templates directory:\", xdg.UserDirs.Templates)\n\tlog.Println(\"Public directory:\", xdg.UserDirs.PublicShare)\n}\n```\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/adrg/xdg.svg)](https://starchart.cc/adrg/xdg)\n\n## Contributing\n\nContributions in the form of pull requests, issues or just general feedback,\nare always welcome.  \nSee [CONTRIBUTING.MD](CONTRIBUTING.md).\n\n**Contributors**:\n[adrg](https://github.com/adrg),\n[wichert](https://github.com/wichert),\n[bouncepaw](https://github.com/bouncepaw),\n[gabriel-vasile](https://github.com/gabriel-vasile),\n[KalleDK](https://github.com/KalleDK),\n[nvkv](https://github.com/nvkv),\n[djdv](https://github.com/djdv),\n[rrjjvv](https://github.com/rrjjvv),\n[GreyXor](https://github.com/GreyXor),\n[Rican7](https://github.com/Rican7),\n[nothub](https://github.com/nothub),\n[korikhin](https://github.com/korikhin).\n\n## References\n\nFor more information see:\n* [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)\n* [XDG user directories](https://wiki.archlinux.org/index.php/XDG_user_directories)\n* [Windows Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid)\n\n## License\n\nCopyright (c) 2014 Adrian-George Bostan.\n\nThis project is licensed under the [MIT license](https://opensource.org/licenses/MIT).\nSee [LICENSE](LICENSE) for more details.\n","funding_links":["https://ko-fi.com/adrg","https://ko-fi.com/T6T72WATK"],"categories":["Configuration","Go","配置","windows","Uncategorized"],"sub_categories":["Standard CLI","标准CLI","Advanced Console UIs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrg%2Fxdg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrg%2Fxdg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrg%2Fxdg/lists"}