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
| 2532 | * @since GDAL 3.3 |
| 2533 | */ |
| 2534 | void 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() */ |