{"id":16586678,"url":"https://github.com/zchee/go-xdgbasedir","last_synced_at":"2025-03-21T13:30:34.556Z","repository":{"id":57481004,"uuid":"82149082","full_name":"zchee/go-xdgbasedir","owner":"zchee","description":"Package xdgbasedir implements a freedesktop XDG Base Directory Specification for Go","archived":false,"fork":false,"pushed_at":"2020-05-31T05:50:53.000Z","size":145,"stargazers_count":14,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-12T22:52:18.048Z","etag":null,"topics":["cross-platform","darwin","go","linux","windows","xdg","xdg-basedir"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/zchee/go-xdgbasedir","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zchee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-16T06:49:19.000Z","updated_at":"2023-08-01T20:05:46.000Z","dependencies_parsed_at":"2022-09-26T17:41:26.551Z","dependency_job_id":null,"html_url":"https://github.com/zchee/go-xdgbasedir","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zchee%2Fgo-xdgbasedir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zchee%2Fgo-xdgbasedir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zchee%2Fgo-xdgbasedir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zchee%2Fgo-xdgbasedir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zchee","download_url":"https://codeload.github.com/zchee/go-xdgbasedir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221815435,"owners_count":16885172,"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","darwin","go","linux","windows","xdg","xdg-basedir"],"created_at":"2024-10-11T22:52:14.008Z","updated_at":"2024-10-28T10:10:41.969Z","avatar_url":"https://github.com/zchee.png","language":"Go","readme":"# go-xdgbasedir\n\n| **linux / darwin**                          | **windows**                                   | **godoc.org**                           |\n|:-------------------------------------------:|:---------------------------------------------:|:---------------------------------------:|\n| [![circleci.com][circleci-badge]][circleci] | [![appveyor-badge][appveyor-badge]][appveyor] | [![godoc.org][godoc-badge]][godoc]      |\n| **coverage**                                | **Release**                                   | **XDG Version**                         |\n| [![codecov.io][codecov-badge]][codecov]     | [![Release][release-badge]][release]          | [![XDG version][xdg-badge]][xdg]        |\n\nPackage `xdgbasedir` implements a freedesktop XDG Base Directory Specification for Go.\n\n## freedesktop.org XDG Base Directory Specification reference:\n\n  - https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.8.html\n  - https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\n\n## Current specification version:\n  \n  - 0.8\n\n## Specification\n\n| func           | linux, darwin (Mode: `Unix`)  | darwin (Mode: `Native`)         |\n|----------------|-------------------------------|---------------------------------|\n| `DataHome()`   | `~/.local/share`              | `~/Library/Application Support` |\n| `ConfigHome()` | `~/.config`                   | `~/Library/Preferences`         |\n| `DataDirs()`   | `/usr/local/share:/usr/share` | `~/Library/Application Support` |\n| `ConfigDirs()` | `/etc/xdg`                    | `~/Library/Preferences`         |\n| `CacheHome()`  | `~/.cache`                    | `~/Library/Caches`              |\n| `RuntimeDir()` | `/run/user/$(id -u)`          | `~/Library/Application Support` |\n\n| func           | windows                               |\n|----------------|---------------------------------------|\n| `DataHome()`   | `C:\\Users\\%USER%\\AppData\\Roaming`     |\n| `ConfigHome()` | `C:\\Users\\%USER%\\AppData\\Roaming`     |\n| `DataDirs()`   | `C:\\Users\\%USER%\\AppData\\Roaming`     |\n| `ConfigDirs()` | `C:\\Users\\%USER%\\AppData\\Roaming`     |\n| `CacheHome()`  | `C:\\Users\\%USER%\\AppData\\Local\\cache` |\n| `RuntimeDir()` | `C:\\Users\\%USER%`                     |\n\n## Note\n\nXDG Base Directory Specification is mainly for GNU/Linux. It does not mention which directory to use with macOS(`darwin`) or `windows`.  \nSo, We referred to the [qt standard paths document](http://doc.qt.io/qt-5/qstandardpaths.html) for the corresponding directory.\n\nWe prepared a `Mode` for users using macOS like Unix. It's `darwin` GOOS specific.  \nIf it is set to `Unix`, it refers to the same path as linux. If it is set to `Native`, it refers to the [Specification](#specification) path.  \nBy default, `Unix`.\n\n`Unix`:\n\n```go\n// +build darwin\n\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/zchee/go-xdgbasedir\"\n)\n\nfunc init() {\n\txdgbasedir.Mode = xdgbasedir.Unix // optional, default is Unix\n}\n\nfunc main() {\n\tfmt.Println(xdgbasedir.DataHome())\n\n\t// Output:\n\t// \"/Users/foo/.local/share\"\n}\n```\n\n`Native`:\n\n```go\n// +build darwin\n\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/zchee/go-xdgbasedir\"\n)\n\nfunc init() {\n\txdgbasedir.Mode = xdgbasedir.Native\n}\n\nfunc main() {\n\tfmt.Println(xdgbasedir.DataHome())\n\n\t// Output:\n\t// \"/Users/foo/Library/Application Support\"\n}\n```\n\n## Badge\n\npowered by [shields.io](https://shields.io).\n\n[![XDGBaseDirSpecVersion](https://img.shields.io/badge/%20XDG%20Base%20Dir%20-%200.8-blue.svg?style=for-the-badge)](https://specifications.freedesktop.org/basedir-spec/0.8/)\n\nmarkdown:\n\n```markdown\n[![XDGBaseDirSpecVersion](https://img.shields.io/badge/%20XDG%20Base%20Dir%20-%200.8-blue.svg?style=for-the-badge)](https://specifications.freedesktop.org/basedir-spec/0.8/)\n```\n\n\n\u003c!-- badge links --\u003e\n[circleci]: https://circleci.com/gh/zchee/workflows/go-xdgbasedir\n[appveyor]: https://ci.appveyor.com/project/zchee/go-xdgbasedir\n[godoc]: https://godoc.org/github.com/zchee/go-xdgbasedir\n[codecov]: https://codecov.io/gh/zchee/go-xdgbasedir\n[release]: https://github.com/zchee/go-xdgbasedir/releases\n[xdg]: https://specifications.freedesktop.org/basedir-spec/0.8/\n\n[circleci-badge]: https://img.shields.io/circleci/project/github/zchee/go-xdgbasedir/master.svg?style=for-the-badge\u0026label=CIRCLECI\u0026logo=circleci\n[appveyor-badge]: https://img.shields.io/appveyor/ci/zchee/go-xdgbasedir/master.svg?label=AppVeyor\u0026style=for-the-badge\u0026logo=appveyor\n[godoc-badge]: https://img.shields.io/badge/godoc-reference-4F73B3.svg?style=for-the-badge\u0026label=GODOC.ORG\u0026logoWidth=25\u0026logo=data%3Aimage%2Fsvg%2Bxml%3Bcharset%3Dutf-8%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iODUgNTUgMTIwIDEyMCI+PHBhdGggZmlsbD0iIzJEQkNBRiIgZD0iTTQwLjIgMTAxLjFjLS40IDAtLjUtLjItLjMtLjVsMi4xLTIuN2MuMi0uMy43LS41IDEuMS0uNWgzNS43Yy40IDAgLjUuMy4zLjZsLTEuNyAyLjZjLS4yLjMtLjcuNi0xIC42bC0zNi4yLS4xek0yNS4xIDExMC4zYy0uNCAwLS41LS4yLS4zLS41bDIuMS0yLjdjLjItLjMuNy0uNSAxLjEtLjVoNDUuNmMuNCAwIC42LjMuNS42bC0uOCAyLjRjLS4xLjQtLjUuNi0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jggMTIuNyAxNC4xIDIyLjMgMS43IDEzLjUtMi4yIDI0LjUtMTEuNSAzMy45LTYuNiA2LjctMTQuNyAxMC45LTI0IDEyLjgtMi43LjUtNS40LjYtOCAuOXptMjMuOC00MC40Yy0uMS0xLjMtLjEtMi4zLS4zLTMuMy0xLjgtOS45LTEwLjktMTUuNS0yMC40LTEzLjMtOS4zIDIuMS0xNS4zIDgtMTcuNSAxNy40LTEuOCA3LjggMiAxNS43IDkuMiAxOC45IDUuNSAyLjQgMTEgMi4xIDE2LjMtLjYgNy45LTQuMSAxMi4yLTEwLjUgMTIuNy0xOS4xeiIvPjwvc3ZnPg==\n[codecov-badge]: https://img.shields.io/codecov/c/github/zchee/go-xdgbasedir/master.svg?style=for-the-badge\u0026label=CODECOV\u0026logo=codecov\n[release-badge]: https://img.shields.io/github/release/zchee/go-xdgbasedir/all.svg?style=for-the-badge\u0026logo=github\n[xdg-badge]: https://img.shields.io/badge/%20XDG%20Base%20Dir%20-%200.8-blue.svg?style=for-the-badge\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzchee%2Fgo-xdgbasedir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzchee%2Fgo-xdgbasedir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzchee%2Fgo-xdgbasedir/lists"}