mirror of
https://github.com/trabucayre/openFPGALoader.git
synced 2026-08-31 02:07:14 +02:00
DATA_DIR override with environment variable (#333)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
/*
|
||||
* Copyright (C) 2023 Gwenhael Goavec-Merou <[email protected]>
|
||||
*/
|
||||
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
|
||||
/*!
|
||||
* \brief return shell environment variable value
|
||||
* \param[in] key: variable name
|
||||
* \return variable value or ""
|
||||
*/
|
||||
const std::string get_shell_env_var(const char* key,
|
||||
const char *def_val) noexcept {
|
||||
const char* ret = std::getenv(key);
|
||||
return std::string(ret ? ret : def_val);
|
||||
}
|
||||
Reference in New Issue
Block a user