]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOTreeHandlerImageAdder.cpp
Fixed bug when user cancels add directory
[creaImageIO.git] / src2 / creaImageIOTreeHandlerImageAdder.cpp
index e384e99c7f3c1b674f939b80f668f3e87aaa7c34..800a8b8f08ae65223edc8a4b0ebc4e02eaa87f64 100644 (file)
@@ -1,8 +1,5 @@
 #include <creaImageIOTreeHandlerImageAdder.h>
 #include <creaImageIOSystem.h>
-//#include <wx/dir.h>
-//#include <wx/filename.h>
-
 #include "boost/filesystem.hpp"
 
 namespace fs = boost::filesystem;
@@ -46,6 +43,7 @@ namespace creaImageIO
     std::vector<std::string>::const_iterator i;
     for (i=filenames.begin();i!=filenames.end();++i)
       {
+                 
        mProgress.IncNumberScannedFiles();
        if (IsHandledFile(*i)) 
          {
@@ -66,10 +64,6 @@ namespace creaImageIO
     AddDirectoryRecursor( directory, recurse );
     GimmickDebugMessage(3,mProgress<<std::endl);
   }
-  //=====================================================================
-
-
-
 
   //=====================================================================
   void TreeHandlerImageAdder::AddFile( const std::string& filename )
@@ -116,60 +110,14 @@ namespace creaImageIO
                AddFile( itr->string() );
              }
            mProgressSignal(mProgress);
-           if (mProgress.GetStop()) break;
+           if (mProgress.GetStop()) 
+             {
+               //itr = end_itr;
+               break;
+             }
          }
       }
   }
-
-    /*
-
-    std::string fileName;
-    std::string dirName = dirpath;
-
-    wxDir dir( std2wx(dirpath) );
-
-    if ( !dir.IsOpened() )
-      {
-        // deal with the error here - wxDir would already log an error message
-        // explaining the exact reason of the failure
-        return;
-      }
-
-    wxString filename;
-
-    bool cont = dir.GetFirst(&filename, wxEmptyString, 
-                            wxDIR_FILES | wxDIR_HIDDEN );
-    while ( cont )
-      {
-       mProgress.IncNumberScannedFiles();
-
-       wxFileName wxffn(dir.GetName(),filename);
-       std::string ffn = wx2std(wxffn.GetFullPath());
-       if (IsHandledFile(ffn)) 
-         {
-           mProgress.IncNumberHandledFiles();
-           AddFile( ffn );
-         }
-       mProgressSignal(mProgress);
-       cont = ( dir.GetNext(&filename) && (!mProgress.GetStop()) );
-      }
-    
-    // Recurse into subdirs
-    if ( recursive )
-      {
-       cont = dir.GetFirst(&filename, wxEmptyString, 
-                           wxDIR_DIRS | wxDIR_HIDDEN );
-       while ( cont )
-         {
-           wxFileName wxffn(dir.GetName(),filename);
-           std::string ffn = wx2std(wxffn.GetFullPath());
-           AddDirectoryRecursor( ffn, recursive);
-           cont = dir.GetNext(&filename);
-         }
-      }
-  
-  */
-  
   //=======================================================================