-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DATA_DIR override with environment variable (#333)
- Loading branch information
1 parent
1bdb117
commit cd8a143
Showing
7 changed files
with
85 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
/* | ||
* Copyright (C) 2023 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> | ||
*/ | ||
|
||
|
||
#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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
/* | ||
* Copyright (C) 2023 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> | ||
*/ | ||
|
||
#ifndef SRC_COMMON_HPP_ | ||
#define SRC_COMMON_HPP_ | ||
|
||
#include <string> | ||
|
||
/*! | ||
* \brief return shell environment variable value | ||
* \param[in] key: variable name | ||
* \param[in] def_val: value to return when not found | ||
* \return variable value or def_val | ||
*/ | ||
const std::string get_shell_env_var(const char* key, | ||
const char *def_val="") noexcept; | ||
|
||
#endif // SRC_COMMON_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters