Commit 1798508e authored by Julien Malik's avatar Julien Malik

BACKOUT: backout 0a19080ac828, see issue #471

parent a4821944
......@@ -26,9 +26,6 @@
#include <cctype>
#include <algorithm>
#include "itksys/SystemTools.hxx"
#include "itksys/Directory.hxx"
#include "otbImage.h"
#include "otbVectorImage.h"
#include "otbImageFileReader.h"
......@@ -1013,26 +1010,29 @@ std::map<std::string, int> TestHelper::RegressionTestBaselines(char *baselineFil
std::map<std::string, int> baselines;
baselines[std::string(baselineFilename)] = 0;
std::string myPath = itksys::SystemTools::GetFilenamePath( baselineFilename );
itksys::Directory myDir;
myDir.Load( myPath.c_str() );
const unsigned int nbFiles = myDir.GetNumberOfFiles();
const std::string originalBaseline = itksys::SystemTools::GetFilenameWithoutLastExtension(baselineFilename);
const unsigned int sizeRef = originalBaseline.size();
std::string originalBaseline(baselineFilename);
myPath.append("/");
for(unsigned int i=0; i<nbFiles; i++)
int x = 0;
std::string::size_type suffixPos = originalBaseline.find_last_of(".");
std::string::size_type maxPathPos = originalBaseline.find_last_of("/");
std::string suffix;
if ((suffixPos != std::string::npos) && ((suffixPos>maxPathPos) || (maxPathPos==std::string::npos)))
{
suffix = originalBaseline.substr(suffixPos, originalBaseline.length());
originalBaseline.erase(suffixPos, originalBaseline.length());
}
while (++x)
{
const std::string curFilename = itksys::SystemTools::GetFilenameWithoutLastExtension( myDir.GetFile( i ) );
if( curFilename.substr(0, sizeRef) == originalBaseline )
std::ostringstream filename;
filename << originalBaseline << "." << x << suffix;
std::ifstream filestream(filename.str().c_str());
if (!filestream)
{
std::string myFile = myPath;
baselines[myFile.append(myDir.GetFile( i ) )] = 0;
break;
}
baselines[filename.str()] = 0;
filestream.close();
}
return baselines;
}
......
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