aboutsummaryrefslogtreecommitdiff
path: root/src/4D_api.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-01-08 22:32:54 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-01-08 22:32:54 +0100
commit9263e1d36eec53ee3c4e4d04da93a032c0596eec (patch)
tree12afe91a09b60a9ae2a1b2fbff8fa81b24ceee41 /src/4D_api.cpp
parentda93fe3bea35ae8d2383e6006b7775bb96af6885 (diff)
downloadPROJ-9263e1d36eec53ee3c4e4d04da93a032c0596eec.tar.gz
PROJ-9263e1d36eec53ee3c4e4d04da93a032c0596eec.zip
Add capability to read resource files from the user writable directory
Diffstat (limited to 'src/4D_api.cpp')
-rw-r--r--src/4D_api.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp
index cee8262e..9107723d 100644
--- a/src/4D_api.cpp
+++ b/src/4D_api.cpp
@@ -48,6 +48,7 @@
#include <math.h>
#include "geodesic.h"
#include "grids.hpp"
+#include "filemanager.hpp"
#include "proj/common.hpp"
#include "proj/coordinateoperation.hpp"
@@ -1450,6 +1451,16 @@ PJ_INFO proj_info (void) {
/* build search path string */
auto ctx = pj_get_default_ctx();
if (!ctx || ctx->search_paths.empty()) {
+ // Env var mostly for testing purposes and being independent from
+ // an existing installation
+ const char* ignoreUserWritableDirectory =
+ getenv("PROJ_IGNORE_USER_WRITABLE_DIRECTORY");
+ if( ignoreUserWritableDirectory == nullptr ||
+ ignoreUserWritableDirectory[0] == '\0' ) {
+ buf = path_append(buf,
+ pj_context_get_user_writable_directory(ctx, false).c_str(),
+ &buf_size);
+ }
const char *envPROJ_LIB = getenv("PROJ_LIB");
buf = path_append(buf, envPROJ_LIB, &buf_size);
#ifdef PROJ_LIB