MCPcopy Create free account
hub / github.com/OSGeo/gdal / CPLLoadConfigOptionsFromPredefinedFiles

Function CPLLoadConfigOptionsFromPredefinedFiles

port/cpl_conv.cpp:2534–2567  ·  view source on GitHub ↗

Load configuration from a set of predefined files. * * If the environment variable (or configuration option) GDAL_CONFIG_FILE is * set, then CPLLoadConfigOptionsFromFile() will be called with the value of * this configuration option as the file location. * * Otherwise, for Unix builds, CPLLoadConfigOptionsFromFile() will be called * with ${sysconfdir}/gdal/gdalrc first where ${sysconfdir} e

Source from the content-addressed store, hash-verified

2532 * @since GDAL 3.3
2533 */
2534void CPLLoadConfigOptionsFromPredefinedFiles()
2535{
2536 const char *pszFile = CPLGetConfigOption("GDAL_CONFIG_FILE", nullptr);
2537 if (pszFile != nullptr)
2538 {
2539 CPLLoadConfigOptionsFromFile(pszFile, false);
2540 }
2541 else
2542 {
2543#ifdef SYSCONFDIR
2544 CPLLoadConfigOptionsFromFile(
2545 CPLFormFilenameSafe(
2546 CPLFormFilenameSafe(SYSCONFDIR, "gdal", nullptr).c_str(),
2547 "gdalrc", nullptr)
2548 .c_str(),
2549 false);
2550#endif
2551
2552#ifdef _WIN32
2553 const char *pszHome = CPLGetConfigOption("USERPROFILE", nullptr);
2554#else
2555 const char *pszHome = CPLGetConfigOption("HOME", nullptr);
2556#endif
2557 if (pszHome != nullptr)
2558 {
2559 CPLLoadConfigOptionsFromFile(
2560 CPLFormFilenameSafe(
2561 CPLFormFilenameSafe(pszHome, ".gdal", nullptr).c_str(),
2562 "gdalrc", nullptr)
2563 .c_str(),
2564 false);
2565 }
2566 }
2567}
2568
2569/************************************************************************/
2570/* CPLStat() */

Callers 2

TEST_FFunction · 0.85
GDALDriverManagerMethod · 0.85

Calls 3

CPLFormFilenameSafeFunction · 0.85
c_strMethod · 0.45

Tested by 1

TEST_FFunction · 0.68