wireplumber/lib/wp/base-dirs.h
George Kiagiadakis f76f45124e base-dirs: add support for finding modules and remove wp_get_module_dir()
This makes things more consistent and allows us also to add more
search paths in the future if necessary.

Also, stop using g_module_build_path() because it's deprecated and
build the path manually. This obviously is not portable to Windows/Mac
or other exotic platforms, but portability is not important at this
point. PipeWire is also not portable beyond Linux & BSD.
2024-03-04 07:07:56 +00:00

68 lines
2 KiB
C

/* WirePlumber
*
* Copyright © 2024 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_BASE_DIRS_H__
#define __WIREPLUMBER_BASE_DIRS_H__
#include "defs.h"
#include "iterator.h"
G_BEGIN_DECLS
/*!
* \brief Flags to specify lookup directories
* \ingroup wpbasedirs
*/
typedef enum { /*< flags >*/
WP_BASE_DIRS_ENV_CONFIG = (1 << 0), /*!< $WIREPLUMBER_CONFIG_DIR */
WP_BASE_DIRS_ENV_DATA = (1 << 1), /*!< $WIREPLUMBER_DATA_DIR */
WP_BASE_DIRS_ENV_MODULE = (1 << 2), /*!< $WIREPLUMBER_MODULE_DIR */
WP_BASE_DIRS_XDG_CONFIG_HOME = (1 << 8), /*!< XDG_CONFIG_HOME/wireplumber */
WP_BASE_DIRS_XDG_DATA_HOME = (1 << 9), /*!< XDG_DATA_HOME/wireplumber */
WP_BASE_DIRS_XDG_CONFIG_DIRS = (1 << 10), /*!< XDG_CONFIG_DIRS/wireplumber */
WP_BASE_DIRS_XDG_DATA_DIRS = (1 << 11), /*!< XDG_DATA_DIRS/wireplumber */
WP_BASE_DIRS_ETC = (1 << 16), /*!< ($prefix)/etc/wireplumber */
WP_BASE_DIRS_PREFIX_SHARE = (1 << 17), /*!< $prefix/share/wireplumber */
WP_BASE_DIRS_PREFIX_LIB = (1 << 18), /*!< $prefix/$libdir/wireplumber-$ABI_version */
WP_BASE_DIRS_FLAG_MODULE = (1 << 24), /*!< the file is a loadable module */
WP_BASE_DIRS_CONFIGURATION =
WP_BASE_DIRS_ENV_CONFIG |
WP_BASE_DIRS_XDG_CONFIG_HOME |
WP_BASE_DIRS_XDG_CONFIG_DIRS |
WP_BASE_DIRS_ETC |
WP_BASE_DIRS_XDG_DATA_DIRS |
WP_BASE_DIRS_PREFIX_SHARE,
WP_BASE_DIRS_DATA =
WP_BASE_DIRS_ENV_DATA |
WP_BASE_DIRS_XDG_DATA_HOME |
WP_BASE_DIRS_XDG_DATA_DIRS |
WP_BASE_DIRS_PREFIX_SHARE,
WP_BASE_DIRS_MODULE =
WP_BASE_DIRS_ENV_MODULE |
WP_BASE_DIRS_PREFIX_LIB |
WP_BASE_DIRS_FLAG_MODULE,
} WpBaseDirsFlags;
WP_API
gchar * wp_base_dirs_find_file (WpBaseDirsFlags flags,
const gchar * subdir, const gchar * filename);
WP_API
WpIterator * wp_base_dirs_new_files_iterator (WpBaseDirsFlags flags,
const gchar * subdir, const gchar * suffix);
G_END_DECLS
#endif