]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMLib.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / modelCDMLib.cpp
index 416c1ff5230050f9bbf21726e2358c6929db00f9..8ebd9ae100555df4211fdc2149729e3b7081062e 100644 (file)
@@ -47,6 +47,7 @@ modelCDMLib::modelCDMLib()
 
 modelCDMLib::modelCDMLib(const std::string& path, const std::string& name, const int& level)
 {
+  std::cout << "creating lib\n";
   this->type = wxDIR_DIRS;
   this->name = name;
   this->level = level;
@@ -97,6 +98,7 @@ modelCDMLib::modelCDMLib(const std::string& path, const std::string& name, const
         }
     }
   this->SortChildren();
+  std::sort(this->libraries.begin(), this->libraries.end(), CompareNodeItem);
 }
 
 modelCDMLib::~modelCDMLib()
@@ -178,7 +180,7 @@ const bool modelCDMLib::Refresh(std::string*& result)
           std::string libraryName = stdfileName;
           //check if they already exist
           bool found = false;
-          for (int i = 0;!found && i < this->libraries.size(); i++)
+          for (int i = 0; !found && i < this->libraries.size(); i++)
             {
               if (this->libraries[i]->GetName() == libraryName)
                 {
@@ -224,7 +226,7 @@ const bool modelCDMLib::Refresh(std::string*& result)
           else
             {
               bool found = false;
-              for (int i = 0; i <!found && this->children.size(); i++)
+              for (int i = 0; !found && i < this->children.size(); i++)
                 {
                   if (this->children[i]->GetName() == stdfileName)
                     {
@@ -266,5 +268,6 @@ const bool modelCDMLib::Refresh(std::string*& result)
         }
     }
   this->SortChildren();
+  std::sort(this->libraries.begin(), this->libraries.end(), CompareNodeItem);
   return true;
 }