Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
obu-firmware builds against the vanetza-idf C-ITS library, which until now came from the colleague's microbu-esp32c5 tree beside the repository and was not tracked here, so a clone of this repository could not build the firmware it ships. The library alone is now part of obu-firmware, as obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from there by default; -DVANETZA_IDF_DIR still points the build elsewhere. The rest of the colleague's tree (their own VAM firmware, PKI tooling, station-link Python tools, the V2X2MAP bridge) stays out of this repository and gitignored; nothing is pushed to their repository. NOTES.md, docs/06, TODO.md and the pcap verifier's usage line point at the new location.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
#include "xdg.hpp"
|
||||
#include <cstdlib>
|
||||
#include <pwd.h>
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace vanetza
|
||||
{
|
||||
namespace pki
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::filesystem::path lookup_xdg_env(const char* env)
|
||||
{
|
||||
const char* env_value = std::getenv(env);
|
||||
if (env_value) {
|
||||
return std::filesystem::path(env_value);
|
||||
} else {
|
||||
return std::filesystem::path {};
|
||||
}
|
||||
}
|
||||
|
||||
std::filesystem::path lookup_home()
|
||||
{
|
||||
const char* home_value = std::getenv("HOME");
|
||||
if (home_value && home_value[0] != '\0') {
|
||||
return std::filesystem::path { home_value };
|
||||
}
|
||||
|
||||
const passwd* pw = ::getpwuid(getuid());
|
||||
if (pw && pw->pw_dir) {
|
||||
return std::filesystem::path { pw->pw_dir };
|
||||
}
|
||||
|
||||
throw std::runtime_error("cannot determine home directory");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::filesystem::path xdg_config_home()
|
||||
{
|
||||
auto config_home = lookup_xdg_env("XDG_CONFIG_HOME");
|
||||
if (config_home.empty()) {
|
||||
config_home = lookup_home() / ".config";
|
||||
}
|
||||
return config_home;
|
||||
}
|
||||
|
||||
std::filesystem::path xdg_data_home()
|
||||
{
|
||||
auto data_home = lookup_xdg_env("XDG_DATA_HOME");
|
||||
if (data_home.empty()) {
|
||||
data_home = lookup_home() / ".local/share";
|
||||
}
|
||||
return data_home;
|
||||
}
|
||||
|
||||
} // namespace pki
|
||||
} // namespace vanetza
|
||||
Reference in New Issue
Block a user