From f6c424165264eec06af2504800ebfdd5d701efae Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 10 Jan 2020 21:54:34 +0100 Subject: Use Win32 Unicode APIs and expect all strings to be UTF-8 (fixes #1765) For backward compatibility, if PROJ_LIB content is found to be not UTF-8 or pointing to a non existing directory, then an attempt at interpretating it in the ANSI page encoding is done. proj_context_set_search_paths() now assumes strings to be in UTF-8, and functions returning paths will also return values in UTF-8. --- src/4D_api.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/4D_api.cpp') diff --git a/src/4D_api.cpp b/src/4D_api.cpp index 9107723d..6b53363a 100644 --- a/src/4D_api.cpp +++ b/src/4D_api.cpp @@ -1461,10 +1461,10 @@ PJ_INFO proj_info (void) { 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); + const std::string envPROJ_LIB = NS_PROJ::FileManager::getProjLibEnvVar(ctx); + buf = path_append(buf, envPROJ_LIB.empty() ? nullptr : envPROJ_LIB.c_str(), &buf_size); #ifdef PROJ_LIB - if (envPROJ_LIB == nullptr) { + if (envPROJ_LIB.empty()) { buf = path_append(buf, PROJ_LIB, &buf_size); } #endif @@ -1770,3 +1770,4 @@ PJ_FACTORS proj_factors(PJ *P, PJ_COORD lp) { return factors; } + -- cgit v1.2.3