This library is only intended for use on Unix systems, some features such as permissions may not work as expected on other operating systems.


  1. C++ compiler with support for C++17 or later
  2. libc++ that supports std::filesystem


This library is just source code. Simply add to your project and compile them statically with it.

Alternatively, you can use the provided CMakeLists.txt file and compile it as a shared or static library.

By default, it is compiled as shared. You can define the BUILD_VARIANT_STATIC variable to make it static.


Custom string implementation

You can replace std::string with your own custom C++ string implementation by defining the UXDG_CUSTOM_STRING macro to be equal to the string's type. Then, you can define UXDG_CUSTOM_STRING_INCLUDE to be a string pointing to the header to include the string from.

Exporting functions from DLLs

To export symbols, define the UVK_LOG_EXPORT_FROM_LIBRARY macro. When compiling into a library, also define UVK_LIB_COMPILE so that other binaries that don't have it installed import the symbols correctly.

It will be set by default if using CMake.

Create missing directories if found

If the UXDG_CREATE_DIRS macro is defined, when handling a directory, it will be checked if it exists. If it does not, it will be created with its appropriate permissions(adds 0700, except when the directory is XDG_RUNTIME_DIR, where it will be replaced by 0700 as defined by the specification).

If using CMake, the CREATE_DIRS can define the macro for you.

Disable ignoring relative directories

By enabling UXDG_DO_NOT_IGNORE_RELATIVE_DIRS the file string will be checked if it's a relative path. The XDG Basedir specification ignores relative paths, so this feature may be useful if you do not to ignore them.

If using CMake, the NO_IGNORE_RELATIVE_DIRS can define the macro for you.