Skip to content

Commit b34207e

Browse files
committed
Replace use of _putenv_s and std::setenv with pdal::Utils::setenv
Fixes Linux build errors due to incorrect string concatenation in non-Windows case.
1 parent ef62770 commit b34207e

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

source/pdal/pdalc_config.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "pdalc_config.h"
66

77
#include <pdal/pdal_config.hpp>
8+
#include <pdal/util/Utils.hpp>
89

910
#include <cstring>
1011
#include <string>
@@ -15,15 +16,6 @@ namespace pdal
1516
{
1617
std::ofstream pdalcConfigLog("pdalc_config.log");
1718

18-
void setenv(const char *name, const char *value)
19-
{
20-
#if defined(_MSC_VER)
21-
_putenv_s(name, value);
22-
#else
23-
std::setenv(std::string(name + "=" + value).c_str());
24-
#endif
25-
}
26-
2719
size_t PDALGetGdalDataPath(char *path, size_t size)
2820
{
2921
size_t length = 0;
@@ -62,15 +54,15 @@ namespace pdal
6254
{
6355
if (path)
6456
{
65-
setenv("GDAL_DATA", path);
57+
pdal::Utils::setenv("GDAL_DATA", path);
6658
}
6759
}
6860

6961
void PDALSetProj4DataPath(const char *path)
7062
{
7163
if (path)
7264
{
73-
setenv("PROJ_LIB", path);
65+
pdal::Utils::setenv("PROJ_LIB", path);
7466
}
7567
}
7668

0 commit comments

Comments
 (0)