/*
 * Copyright (C) 2023-2025 Birb Developers
 *
 * Birb is the legal property of its developers, whose names are too
 * numerous to list here. Please refer to the AUTHORS file distributed
 * with this source distribution
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <https://www.gnu.org/licenses/>.
 */

#if !defined(BIRB_GLOBAL_HEADER_INSIDE) && !defined(BIRB_COMPILATION)
# error "only <birb.h> may be included directly"
#endif

#ifndef BIRB_ENV_H
#define BIRB_ENV_H

#include <glib.h>

#include "birbversion.h"

G_BEGIN_DECLS

/**
 * birb_env_append:
 * @variable: the variable to append to
 * @value: the value to append
 * @separator: the separator to use
 *
 * Appends a value to an environment variable with the given separator.
 *
 * This is meant to be used to add an addition value to a multi-value
 * environment variable like `PATH`, `GI_TYPELIB_PATH`, etc
 *
 * See the documentation for [func@GLib.setenv] for potential issues with this
 * function.
 *
 * Returns: false if the environment variable could not be set.
 *
 * Since: 0.3
 */
BIRB_AVAILABLE_IN_0_3
gboolean birb_env_append(const char *variable, const char *value, const char *separator);

/**
 * birb_env_prepend:
 * @variable: the variable to prepend to
 * @value: the value to prepend
 * @separator: the separator to use
 *
 * Prepends a value to an environment variable with the given separator.
 *
 * This is meant to be used to add an addition value to a multi-value
 * environment variable like `PATH`, `GI_TYPELIB_PATH`, etc
 *
 * See the documentation for [func@GLib.setenv] for potential issues with this
 * function.
 *
 * Returns: false if the environment variable could not be set.
 *
 * Since: 0.3
 */
BIRB_AVAILABLE_IN_0_3
gboolean birb_env_prepend(const char *variable, const char *value, const char *separator);

G_END_DECLS

#endif /* BIRB_ENV_H */
