aboutsummaryrefslogtreecommitdiff
path: root/src/xdg.hpp
blob: 94dbf9ba30c537d5907450fa56f88a812e8d6b34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
 * @file   xdg.hpp
 * @author Felix Morgner (felix.morgner@gmail.com)
 * @since  1.0.0
 */

#ifndef WANDA_XDG_HPP
#define WANDA_XDG_HPP

#include "environment.hpp"

#include <cstddef>
#include <filesystem>
#include <type_traits>

namespace wanda
{
  /**
   * @brief An @p enum to represet the standardized XDG directories
   */
  enum struct xdg_directory : std::underlying_type_t<std::byte>
  {
    data_home,
    config_home,
    cache_home,
    runtime_dir,
  };

  /**
   * @brief Get the name of the environment variable associated with the given XDG directory
   */
  std::string xdg_variable(xdg_directory directory);

  /**
   * @brief Get the path to the given @p directory given the provided @p environment
   */
  std::filesystem::path xdg_path_for(xdg_directory directory, environment const & environment);
}  // namespace wanda

#endif