aboutsummaryrefslogtreecommitdiff
path: root/src/4D_api.cpp
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2019-06-05 19:28:17 +0200
committerGitHub <noreply@github.com>2019-06-05 19:28:17 +0200
commit97fe47939d290c8b8514dc4960d7f6f80e3f813c (patch)
tree39df71f2d2520a7bc99ed7ae88ce6aa1935c236d /src/4D_api.cpp
parente16b5585d59f1e153d67f04c8199a2468b89563f (diff)
parent32dbd955015a596980f2ba30598496c808972bed (diff)
downloadPROJ-97fe47939d290c8b8514dc4960d7f6f80e3f813c.tar.gz
PROJ-97fe47939d290c8b8514dc4960d7f6f80e3f813c.zip
[Backport 6.1] proj_info().searchpath should not include PROJ_LIB path (#1499)
[Backport 6.1] proj_info().searchpath should not include PROJ_LIB path
Diffstat (limited to 'src/4D_api.cpp')
-rw-r--r--src/4D_api.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp
index 81e16600..5d84e6c6 100644
--- a/src/4D_api.cpp
+++ b/src/4D_api.cpp
@@ -1403,16 +1403,17 @@ PJ_INFO proj_info (void) {
info.release = pj_get_release ();
/* build search path string */
- const char* envPROJ_LIB = getenv ("PROJ_LIB");
- buf = path_append (buf, envPROJ_LIB, &buf_size);
+ auto ctx = pj_get_default_ctx();
+ if (!ctx || ctx->search_paths.empty()) {
+ const char *envPROJ_LIB = getenv("PROJ_LIB");
+ buf = path_append(buf, envPROJ_LIB, &buf_size);
#ifdef PROJ_LIB
- if( envPROJ_LIB == nullptr ) {
- buf = path_append (buf, PROJ_LIB, &buf_size);
- }
+ if (envPROJ_LIB == nullptr) {
+ buf = path_append(buf, PROJ_LIB, &buf_size);
+ }
#endif
- auto ctx = pj_get_default_ctx();
- if( ctx ) {
- for( const auto& path: ctx->search_paths ) {
+ } else {
+ for (const auto &path : ctx->search_paths) {
buf = path_append(buf, path.c_str(), &buf_size);
}
}