Skip to content
Snippets Groups Projects
Commit 646f3c19 authored by Julien Malik's avatar Julien Malik
Browse files

ENH: test file existence before asking GDALImageIO to read it

parent 67585c0a
No related branches found
No related tags found
Loading
......@@ -221,6 +221,13 @@ void TileMapImageIO::GenerateTileInfo(double x, double y, int numTileX, int numT
*/
bool TileMapImageIO::CanReadFromCache(std::string filename)
{
// Verify that the file exists and is not a directory
bool fileExists = itksys::SystemTools::FileExists(filename.c_str(), true);
if (!fileExists)
{
return false;
}
itk::ImageIOBase::Pointer imageIO;
imageIO = otb::GDALImageIO::New();
return imageIO->CanReadFile(filename.c_str());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment