From 85bb625190d8c9abe930d7f62c5ca550a63e1571 Mon Sep 17 00:00:00 2001 From: tomoya Date: Fri, 16 Oct 2020 21:28:28 +0900 Subject: [PATCH] replace custom get env login into rcutils_get_env(). (#99) Signed-off-by: Tomoya.Fujita --- include/rcpputils/filesystem_helper.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/rcpputils/filesystem_helper.hpp b/include/rcpputils/filesystem_helper.hpp index 93fa580..8096aba 100644 --- a/include/rcpputils/filesystem_helper.hpp +++ b/include/rcpputils/filesystem_helper.hpp @@ -77,6 +77,7 @@ #endif #include "rcpputils/split.hpp" +#include "rcutils/get_env.h" namespace rcpputils { @@ -451,8 +452,9 @@ inline path temp_directory_path() } temp_path[size] = '\0'; #else - const char * temp_path = getenv("TMPDIR"); - if (!temp_path) { + const char * temp_path = NULL; + const char * ret_str = rcutils_get_env("TMPDIR", &temp_path); + if (NULL != ret_str || *temp_path == '\0') { temp_path = "/tmp"; } #endif