aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}
}