CPLDefaultFindFile */
| 130 | |
| 131 | /** CPLDefaultFindFile */ |
| 132 | const char *CPLDefaultFindFile(const char *pszClass, const char *pszBasename) |
| 133 | |
| 134 | { |
| 135 | FindFileTLS *pTLSData = CPLGetFindFileTLS(); |
| 136 | if (pTLSData == nullptr) |
| 137 | return nullptr; |
| 138 | const int nLocations = CSLCount(pTLSData->papszFinderLocations); |
| 139 | |
| 140 | for (int i = nLocations - 1; i >= 0; i--) |
| 141 | { |
| 142 | const std::string osResult = CPLFormFilenameSafe( |
| 143 | pTLSData->papszFinderLocations[i], pszBasename, nullptr); |
| 144 | |
| 145 | VSIStatBufL sStat; |
| 146 | if (VSIStatL(osResult.c_str(), &sStat) == 0) |
| 147 | return CPLSPrintf("%s", osResult.c_str()); |
| 148 | } |
| 149 | |
| 150 | if (EQUAL(pszClass, "gdal") && !CPLGetConfigOption("GDAL_DATA", nullptr)) |
| 151 | { |
| 152 | CPLError(CE_Warning, CPLE_FileIO, |
| 153 | "Cannot find %s (GDAL_DATA is not defined)", pszBasename); |
| 154 | } |
| 155 | |
| 156 | return nullptr; |
| 157 | } |
| 158 | |
| 159 | /************************************************************************/ |
| 160 | /* CPLFindFile() */ |
nothing calls this directly
no test coverage detected