diff options
| author | Nyall Dawson <nyall.dawson@gmail.com> | 2019-06-02 23:17:02 +0000 |
|---|---|---|
| committer | Nyall Dawson <nyall.dawson@gmail.com> | 2019-06-02 23:23:59 +0000 |
| commit | 32dbd955015a596980f2ba30598496c808972bed (patch) | |
| tree | 39df71f2d2520a7bc99ed7ae88ce6aa1935c236d /src/4D_api.cpp | |
| parent | e16b5585d59f1e153d67f04c8199a2468b89563f (diff) | |
| download | PROJ-32dbd955015a596980f2ba30598496c808972bed.tar.gz PROJ-32dbd955015a596980f2ba30598496c808972bed.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); } } |
