diff options
| author | Nyall Dawson <nyall.dawson@gmail.com> | 2019-06-03 09:17:02 +1000 |
|---|---|---|
| committer | Nyall Dawson <nyall.dawson@gmail.com> | 2019-06-03 09:23:59 +1000 |
| commit | e7c8fb89d38801affa743b0c1d8ef990b3c2f431 (patch) | |
| tree | 9fd1d5df6651873a591b72cc82675b5e9208d1df /src/4D_api.cpp | |
| parent | ee34d0684d62abb0eec3163733d13704a817878a (diff) | |
| download | PROJ-e7c8fb89d38801affa743b0c1d8ef990b3c2f431.tar.gz PROJ-e7c8fb89d38801affa743b0c1d8ef990b3c2f431.zip | |
proj_info().searchpath should not include PROJ_LIB path if
the context search_paths is not empty
The logic used when actually searching for files is that if
the context search_paths are set, these completely override
the PROJ_LIB variable. So we should make proj_info().searchpath
correctly reflect this, and not include the PROJ_LIB path
in searchpath if the context has search_paths manually set.
Diffstat (limited to 'src/4D_api.cpp')
| -rw-r--r-- | src/4D_api.cpp | 17 |
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); } } |
