Commit 80639983 authored by Guillaume Pasero's avatar Guillaume Pasero

BUG: Mantis-1401: only scan directory parent of IMAGEDATA

parent 99eec4e9
......@@ -2400,56 +2400,36 @@ bool ossimplugins::ossimTerraSarModel::findTSXLeader(const ossimFilename& file,
}
else
{
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimplugins::ossimTerraSarModel::findTSXLeader "
<< " directory scan turned off. This is killing the factory open."
<< " We should never scan a directory. Need to resolve. "
<< std::endl;
}
//#if 0
ossimFilename imagePath = file.path();
if (imagePath.empty())
imagePath = ossimEnvironmentUtility::instance()->getCurrentWorkingDir();
ossimDirectory directory = ossimDirectory(imagePath.path());
std::vector<ossimFilename> vectName;
ossimString reg = ".xml";
directory.findAllFilesThatMatch( vectName, reg, 1 );
bool goodFileFound = false;
unsigned int loop = 0;
while(loop<vectName.size() && !goodFileFound)
{
ossimFilename curFile = vectName[loop];
if(curFile.file().beforePos(3) == ossimString("TSX"))
goodFileFound = true;
else
loop++;
}
if(goodFileFound)
{
metadataFile = vectName[loop];
res = true;
}
else
{
if (traceDebug())
{
if (res)
{
this->print(ossimNotify(ossimNotifyLevel_DEBUG));
}
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimplugins::ossimTerraSarModel::findTSXLeader "
<< " exit status = " << (res?"true":"false\n")
<< std::endl;
}
ossimFilename imagePath = file.expand().path();
if (imagePath.file() == ossimString("IMAGEDATA"))
{
std::cerr << "SCANNING DIRECTORY" << std::endl;
ossimFilename productPath = imagePath.path();
ossimDirectory directory = ossimDirectory(productPath);
std::vector<ossimFilename> vectName;
ossimString reg = "^T(S|D)X1_SAR__.*\\.xml$";
directory.findAllFilesThatMatch( vectName, reg, 1 );
if (vectName.size())
{
metadataFile = vectName[0];
res = true;
}
else
{
if (traceDebug())
{
if (res)
{
this->print(ossimNotify(ossimNotifyLevel_DEBUG));
}
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimplugins::ossimTerraSarModel::findTSXLeader "
<< " exit status = " << (res?"true":"false\n")
<< std::endl;
}
}
}
//#endif
}
return res;
......
Markdown is supported
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