| 1 |
/* WirePlumber |
| 2 |
* |
| 3 |
* Copyright © 2024 Collabora Ltd. |
| 4 |
* @author George Kiagiadakis <[email protected]> |
| 5 |
* |
| 6 |
* SPDX-License-Identifier: MIT |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef __WIREPLUMBER_BASE_DIRS_H__ |
| 10 |
#define __WIREPLUMBER_BASE_DIRS_H__ |
| 11 |
|
| 12 |
#include "defs.h" |
| 13 |
#include "iterator.h" |
| 14 |
|
| 15 |
G_BEGIN_DECLS |
| 16 |
|
| 17 |
/*! |
| 18 |
* \brief Flags to specify lookup directories |
| 19 |
* \ingroup wpbasedirs |
| 20 |
* |
| 21 |
* These flags can be used to specify which directories to look for a file in. |
| 22 |
* The flags can be combined to search in multiple directories at once. Some |
| 23 |
* flags may also used to specify the type of the file being looked up or other |
| 24 |
* lookup parameters. |
| 25 |
* |
| 26 |
* Lookup is performed in the same order as the flags are listed here. Note that |
| 27 |
* if a WirePlumber-specific environment variable is set ($WIREPLUMBER_*_DIR) |
| 28 |
* and the equivalent WP_BASE_DIRS_ENV_* flag is specified, the lookup in other |
| 29 |
* directories is skipped, even if the file is not found in the |
| 30 |
* environment-specified directory. |
| 31 |
*/ |
| 32 |
typedef enum { /*< flags >*/ |
| 33 |
WP_BASE_DIRS_ENV_CONFIG = (1 << 0), /*!< $WIREPLUMBER_CONFIG_DIR */ |
| 34 |
WP_BASE_DIRS_ENV_DATA = (1 << 1), /*!< $WIREPLUMBER_DATA_DIR */ |
| 35 |
WP_BASE_DIRS_ENV_MODULE = (1 << 2), /*!< $WIREPLUMBER_MODULE_DIR */ |
| 36 |
|
| 37 |
WP_BASE_DIRS_XDG_CONFIG_HOME = (1 << 8), /*!< XDG_CONFIG_HOME */ |
| 38 |
WP_BASE_DIRS_XDG_DATA_HOME = (1 << 9), /*!< XDG_DATA_HOME */ |
| 39 |
|
| 40 |
WP_BASE_DIRS_XDG_CONFIG_DIRS = (1 << 10), /*!< XDG_CONFIG_DIRS */ |
| 41 |
WP_BASE_DIRS_BUILD_SYSCONFDIR = (1 << 11), /*!< compile-time $sysconfdir (/etc) */ |
| 42 |
|
| 43 |
WP_BASE_DIRS_XDG_DATA_DIRS = (1 << 12), /*!< XDG_DATA_DIRS */ |
| 44 |
WP_BASE_DIRS_BUILD_DATADIR = (1 << 13), /*!< compile-time $datadir ($prefix/share) */ |
| 45 |
|
| 46 |
WP_BASE_DIRS_BUILD_LIBDIR = (1 << 14), /*!< compile-time $libdir ($prefix/lib) */ |
| 47 |
|
| 48 |
/*! the file is a loadable module; prepend "lib" and append ".so" if needed */ |
| 49 |
WP_BASE_DIRS_FLAG_MODULE = (1 << 24), |
| 50 |
|
| 51 |
/*! append "/wireplumber" to the location, except in the case of locations |
| 52 |
that are specified via WirePlumber-specific environment variables; |
| 53 |
in LIBDIR, append "/wireplumber-$API_version" instead */ |
| 54 |
WP_BASE_DIRS_FLAG_SUBDIR_WIREPLUMBER = (1 << 25), |
| 55 |
|
| 56 |
WP_BASE_DIRS_CONFIGURATION = |
| 57 |
(WP_BASE_DIRS_ENV_CONFIG | |
| 58 |
WP_BASE_DIRS_XDG_CONFIG_HOME | |
| 59 |
WP_BASE_DIRS_XDG_CONFIG_DIRS | |
| 60 |
WP_BASE_DIRS_BUILD_SYSCONFDIR | |
| 61 |
WP_BASE_DIRS_XDG_DATA_DIRS | |
| 62 |
WP_BASE_DIRS_BUILD_DATADIR | |
| 63 |
WP_BASE_DIRS_FLAG_SUBDIR_WIREPLUMBER), |
| 64 |
|
| 65 |
WP_BASE_DIRS_DATA = |
| 66 |
(WP_BASE_DIRS_ENV_DATA | |
| 67 |
WP_BASE_DIRS_XDG_DATA_HOME | |
| 68 |
WP_BASE_DIRS_XDG_DATA_DIRS | |
| 69 |
WP_BASE_DIRS_BUILD_DATADIR | |
| 70 |
WP_BASE_DIRS_FLAG_SUBDIR_WIREPLUMBER), |
| 71 |
|
| 72 |
WP_BASE_DIRS_MODULE = |
| 73 |
(WP_BASE_DIRS_ENV_MODULE | |
| 74 |
WP_BASE_DIRS_BUILD_LIBDIR | |
| 75 |
WP_BASE_DIRS_FLAG_MODULE | |
| 76 |
WP_BASE_DIRS_FLAG_SUBDIR_WIREPLUMBER), |
| 77 |
} WpBaseDirsFlags; |
| 78 |
|
| 79 |
WP_API |
| 80 |
gchar * wp_base_dirs_find_file (WpBaseDirsFlags flags, |
| 81 |
const gchar * subdir, const gchar * filename); |
| 82 |
|
| 83 |
WP_API |
| 84 |
WpIterator * wp_base_dirs_new_files_iterator (WpBaseDirsFlags flags, |
| 85 |
const gchar * subdir, const gchar * suffix); |
| 86 |
|
| 87 |
G_END_DECLS |
| 88 |
|
| 89 |
#endif |