void FilesFromDirectory::CleanFilenames( std::string basePath )
{
std::string tmpString;
- int i,ii,sizeFilenames = Filenames.size();
- int j,sizeFileEnd = bbGetInputFileEnd().size();
-
+ int i,ii,sizeFilenames = Filenames.size();
+ int j,sizeFileEnd = bbGetInputFileEnd().size();
int okEraseElement;
-
+ int posStr;
//Selecting just the files in the FileEnd List
if (bbGetInputFileEnd().size()!=0)
{
for (i=sizeFilenames-1; i>=0; i--)
{
- okEraseElement=0;
+ okEraseElement = 0;
for (j=0; j<sizeFileEnd; j++)
{
- std::string tmp=Filenames[i].substr( (Filenames[i].length()) - (bbGetInputFileEnd()[j]).length() ) ;
- if (bbGetInputFileEnd()[j].compare( tmp )==0 )
+ posStr=(Filenames[i].length()) - (bbGetInputFileEnd()[j]).length();
+ if (posStr>=0)
{
- okEraseElement++;
- } // if FileEnd
+ std::string tmp=Filenames[i].substr( posStr ) ;
+ if (bbGetInputFileEnd()[j].compare( tmp )==0 )
+ {
+ okEraseElement++;
+ } // if FileEnd
+ }// if posStr
} // for j
if (okEraseElement==0)
}
} // for i
} // if FileEnd !=0
-
sizeFilenames = Filenames.size();
-
// Cleanning paths with spaces
for (i=0; i<sizeFilenames; i++)
{
tmpString=Filenames[i];
-
std::string::size_type spacePosition = tmpString.find_first_of(' ');
if (spacePosition != std::string::npos)
{
} // if spacePosition
}
-
// Alphabetical order
for (i=0; i<sizeFilenames; i++)
{
} // if
} // for ii
} // for i
-
// Creating SimpleFilenames
unsigned int lenghtBasePath = basePath.length();
for (i=0; i<sizeFilenames; i++)
{
SimpleFilenames.push_back( Filenames[i].substr( lenghtBasePath ) );
} // for i
-
}