{"id":23318643,"url":"https://github.com/peelonet/peelo-xdg","last_synced_at":"2026-03-08T07:33:18.166Z","repository":{"id":80332128,"uuid":"401737960","full_name":"peelonet/peelo-xdg","owner":"peelonet","description":"C++17 alternative for libxdg-basedir","archived":false,"fork":false,"pushed_at":"2025-10-28T22:48:48.000Z","size":146,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-29T00:29:22.646Z","etag":null,"topics":["filesystem-library","xdg","xdg-basedir"],"latest_commit_sha":null,"homepage":"https://peelonet.github.io/peelo-xdg/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peelonet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"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}},"created_at":"2021-08-31T14:41:31.000Z","updated_at":"2025-10-28T22:48:17.000Z","dependencies_parsed_at":"2025-05-17T08:37:07.910Z","dependency_job_id":null,"html_url":"https://github.com/peelonet/peelo-xdg","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/peelonet/peelo-xdg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peelonet%2Fpeelo-xdg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peelonet%2Fpeelo-xdg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peelonet%2Fpeelo-xdg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peelonet%2Fpeelo-xdg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peelonet","download_url":"https://codeload.github.com/peelonet/peelo-xdg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peelonet%2Fpeelo-xdg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30248957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T05:41:50.788Z","status":"ssl_error","status_checked_at":"2026-03-08T05:41:39.075Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["filesystem-library","xdg","xdg-basedir"],"created_at":"2024-12-20T17:17:49.005Z","updated_at":"2026-03-08T07:33:18.148Z","avatar_url":"https://github.com/peelonet.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# peelo-xdg\n\n![Build](https://github.com/peelonet/peelo-xdg/workflows/Build/badge.svg)\n\n[C++17] header only alternative to [libxdg-basedir] library.\n\n[Doxygen generated API documentation](https://peelonet.github.io/peelo-xdg/)\n\n## API\n\n### peelo::xdg::data_dir() -\u003e [optional]\\\u003c[filesystem::path]\\\u003e\n\nDirectory for user-specific data files.\n\n### peelo::xdg::config_dir() -\u003e [optional]\\\u003c[filesystem::path]\\\u003e\n\nDirectory for user-specific configuration files.\n\n### peelo::xdg::state_dir() -\u003e [optional]\\\u003c[filesystem::path]\\\u003e\n\nDirectory for user-specific state files.\n\n### peelo::xdg::cache_dir() -\u003e [optional]\\\u003c[filesystem::path]\\\u003e\n\nDirectory for user-specific non-essential data files.\n\n### peelo::xdg::runtime_dir() -\u003e [optional]\\\u003c[filesystem::path]\\\u003e\n\nDirectory for user-specific non-essential runtime files and other file objects\n(such as sockets, named pipes, etc).\n\n### peelo::xdg::all_data_dirs() -\u003e [vector]\\\u003c[filesystem::path]\\\u003e\n\nAll directories for user-specific data files in users preferred order.\n\n### peelo::xdg::all_config_dirs() -\u003e [vector]\\\u003c[filesystem::path]\\\u003e\n\nAll directories for user-specific configuration files in users preferred order.\n\n### peelo::xdg::home_dir() -\u003e [optional]\\\u003c[filesystem::path]\\\u003e\n\nUsers home directory.\n\n## Example\n\nLets first create an `CMakeLists.txt` file for our project:\n\n```cmake\ncmake_minimum_required(VERSION 3.12)\nproject(MyProject LANGUAGES CXX)\n\ninclude(FetchContent)\nFetchContent_Declare(\n  PeeloXdg\n  GIT_REPOSITORY\n    https://github.com/peelonet/peelo-xdg.git\n  GIT_TAG\n    1.0.0\n)\nFetchContent_MakeAvailable(PeeloXdg)\n\nadd_executable(MyProject main.cpp)\ntarget_link_libraries(MyProject PRIVATE PeeloXdg)\n```\n\nThen `main.cpp` like this:\n\n```c++\n#include \u003ciostream\u003e\n\n#include \u003cpeelo/xdg.hpp\u003e\n\nint main(int argc, char** argv)\n{\n  if (const auto config_dir = peelo::xdg::config_dir())\n  {\n    const auto app_config_dir = *config_dir / \"MyProject\";\n\n    // Create application config directory, if it does not already exist.\n    if (!std::filesystem::is_directory(app_config_dir))\n    {\n      std::filesystem::create_directories(app_config_dir);\n      std::cout \u003c\u003c \"Configuration directory created.\" \u003c\u003c std::endl;\n    } else {\n      std::cout \u003c\u003c \"Configuration directory already exists.\" \u003c\u003c std::endl;\n    }\n  } else {\n    std::cout \u003c\u003c \"Could not determine configuration directory.\" \u003c\u003c std::endl;\n  }\n\n  return 0;\n}\n```\n\nAfter compiling the application and running it, an directory called `MyProject`\nwill be created under the XDG configuration directory, if one can be\ndetermined based on the environment variable `XDG_CONFIG_DIR`.\n\n[C++17]: https://en.cppreference.com/w/cpp/17\n[libxdg-basedir]: https://github.com/devnev/libxdg-basedir\n[optional]: https://en.cppreference.com/w/cpp/utility/optional\n[filesystem::path]: https://en.cppreference.com/w/cpp/filesystem/path\n[vector]: https://en.cppreference.com/w/cpp/container/vector\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeelonet%2Fpeelo-xdg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeelonet%2Fpeelo-xdg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeelonet%2Fpeelo-xdg/lists"}