Commit 3dbfec54 authored by Victor Poughon's avatar Victor Poughon
Browse files

ImageFileReader: Fix misleading error handling for directories

GetGdalReadImageFileName does not set its second argument when its first
argument is a non empty directory and not a supported format (OTB
supports opening directories in some cases). But in that case it does
return false, which was not handled before this commit. This resulted in
a misleading error message and a corrupted m_FileName.
No related merge requests found
Showing with 6 additions and 10 deletions
+6 -10
......@@ -251,11 +251,8 @@ void
ImageFileReader<TOutputImage, ConvertPixelTraits>
::GenerateOutputInformation(void)
{
typename TOutputImage::Pointer output = this->GetOutput();
itkDebugMacro(<< "Reading file for GenerateOutputInformation()" << this->m_FileName);
// Check to see if we can read the file given the name or prefix
if (this->m_FileName == "")
{
......@@ -265,13 +262,12 @@ ImageFileReader<TOutputImage, ConvertPixelTraits>
// Find real image file name
// !!!! Update FileName
std::string lFileName;
bool found = GetGdalReadImageFileName(this->m_FileName, lFileName);
if (found == false)
{
otbMsgDebugMacro(<< "Filename was NOT unknown. May be recognized by a Image factory!");
}
// Update FileName
this->m_FileName = lFileName;
bool found = GetGdalReadImageFileName(this->m_FileName, lFileName);
if (found)
{
// Update FileName
this->m_FileName = lFileName;
}
if (this->m_UserSpecifiedImageIO == false) //try creating via factory
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment