]> Creatis software - bbtk.git/commitdiff
#2853 BBTK Feature New Normal std:FilesFromDirectory box add option to create list...
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 25 Feb 2016 09:22:51 +0000 (10:22 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 25 Feb 2016 09:22:51 +0000 (10:22 +0100)
packages/std/src/bbstdFilesFromDirectory.cxx

index 1aefdb16e4005719a68219f62bb9b1cf6b79fb1e..05283bcc7017b62055760b9e5a0b1e0fe9695fa5 100644 (file)
@@ -48,9 +48,10 @@ BBTK_BLACK_BOX_IMPLEMENTATION(FilesFromDirectory,bbtk::AtomicBlackBox);
 void FilesFromDirectory::Process()
 {
        Filenames.clear();
+       SimpleFilenames.clear();
        DirName         = bbGetInputIn();
        bool rec        = bbGetInputRecursive();
-       /*int nbFiles = */ Explore(DirName, rec);
+       /*int nbFiles = */ Explore(DirName, rec);
        CleanFilenames( bbGetInputIn() );
        bbSetOutputOut(Filenames);   
        bbSetOutputOutSimple(SimpleFilenames);   
@@ -113,7 +114,6 @@ int FilesFromDirectory::Explore(std::string const &dirpath, bool recursive)
        //assert( dirName[dirName.size()-1] == '' );
        HANDLE hFile = FindFirstFile((dirName+"*").c_str(), &fileData);
 
-
        for(BOOL b = (hFile != INVALID_HANDLE_VALUE); b;
        b = FindNextFile(hFile, &fileData))
        {
@@ -125,14 +125,16 @@ int FilesFromDirectory::Explore(std::string const &dirpath, bool recursive)
          {
                        if (bbGetInputType()==1)
                        {
-                               Filenames.push_back(fileName);   
-                               numberOfFiles++;
+                       std::string temp = dirName+fileName;
+                       Filenames.push_back(temp);       
+                       numberOfFiles++;
                        } // Type ALL_directories
 
                        tmpNumberOfFiles        =       Explore(dirName+fileName, recursive);
                        if ((bbGetInputType()==2)&&tmpNumberOfFiles==0)
                        {
-                       Filenames.push_back(fileName);   
+                       std::string temp = dirName+fileName;
+                       Filenames.push_back(temp);       
                        numberOfFiles++;
                        } // Type Lsast_directories
                        
@@ -268,6 +270,7 @@ void FilesFromDirectory::CleanFilenames( std::string basePath )
        std::string tmpString;
        int i,ii,sizeFilenames = Filenames.size();
 
+
 // Cleanning paths with spaces 
        for (i=0; i<sizeFilenames; i++)
        {
@@ -301,6 +304,7 @@ void FilesFromDirectory::CleanFilenames( std::string basePath )
        unsigned int lenghtBasePath = basePath.length();
        for (i=0; i<sizeFilenames; i++)
        {
+
                SimpleFilenames.push_back( Filenames[i].substr( lenghtBasePath ) );
        } // for i