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;
{
std::string stdfileName = crea::wx2std(fileName);
- modelCDMLibrary* library = new modelCDMLibrary(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
- this->libraries.push_back(library);
- this->children.push_back(library);
+ if(stdfileName != "template_lib")
+ {
+ modelCDMLibrary* library = new modelCDMLibrary(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->libraries.push_back(library);
+ this->children.push_back(library);
+ }
+ else
+ {
+ modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(folder);
+ }
cont = dir.GetNext(&fileName);
}
}
}
this->SortChildren();
+ std::sort(this->libraries.begin(), this->libraries.end(), CompareNodeItem);
}
modelCDMLib::~modelCDMLib()
while (cont)
{
std::string stdfileName = crea::wx2std(fileName);
- std::string libraryName = stdfileName;
- //check if they already exist
- bool found = false;
- for (int i = 0;!found && i < this->libraries.size(); i++)
+
+ if(stdfileName != "template_lib")
{
- if (this->libraries[i]->GetName() == libraryName)
+ std::string libraryName = stdfileName;
+ //check if library already exist
+ bool found = false;
+ for (int i = 0; !found && i < this->libraries.size(); i++)
{
- found = true;
- int pos = std::find(this->children.begin(), this->children.end(), this->libraries[i]) - this->children.begin();
- checked[pos] = true;
- checkedLibraries[i] = true;
- if(!this->libraries[i]->Refresh(result))
- return false;
+ if (this->libraries[i]->GetName() == libraryName)
+ {
+ found = true;
+ int pos = std::find(this->children.begin(), this->children.end(), this->libraries[i]) - this->children.begin();
+ checked[pos] = true;
+ checkedLibraries[i] = true;
+ if(!this->libraries[i]->Refresh(result))
+ return false;
+ }
+ }
+ if(!found)
+ {
+ modelCDMLibrary* library = new modelCDMLibrary(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->libraries.push_back(library);
+ this->children.push_back(library);
}
}
- if(!found)
+ else
{
- modelCDMLibrary* library = new modelCDMLibrary(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
- this->libraries.push_back(library);
- this->children.push_back(library);
+ //check if folder already exist
+ bool found = false;
+ for (int i = 0; !found && i < this->children.size(); i++)
+ {
+ if (this->children[i]->GetName() == stdfileName)
+ {
+ found = true;
+ checked[i] = true;
+ if(!this->children[i]->Refresh(result))
+ return false;
+ }
+ }
+ if(!found)
+ {
+ modelCDMFolder* folder= new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+ this->children.push_back(folder);
+ }
}
cont = dir.GetNext(&fileName);
}
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)
{
}
}
this->SortChildren();
+ std::sort(this->libraries.begin(), this->libraries.end(), CompareNodeItem);
return true;
}