From: Eduardo DAVILA Date: Thu, 25 Feb 2016 09:22:51 +0000 (+0100) Subject: #2853 BBTK Feature New Normal std:FilesFromDirectory box add option to create list... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b459e1177db6455b4a60afe8cbb7ad608231ed95;p=bbtk.git #2853 BBTK Feature New Normal std:FilesFromDirectory box add option to create list of directories --- diff --git a/packages/std/src/bbstdFilesFromDirectory.cxx b/packages/std/src/bbstdFilesFromDirectory.cxx index 1aefdb1..05283bc 100644 --- a/packages/std/src/bbstdFilesFromDirectory.cxx +++ b/packages/std/src/bbstdFilesFromDirectory.cxx @@ -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