modelCDMLibrary::modelCDMLibrary(const std::string& path, const std::string& name, const int& level)
{
+ std::cout << "creating library: " + path + "\n";
//folder name
this->name = name;
//path
}
}
this->SortChildren();
+ std::sort(this->folders.begin(), this->folders.end(), CompareNodeItem);
}
modelCDMLibrary::~modelCDMLibrary()
const bool modelCDMLibrary::Refresh(std::string*& result)
{
+ std::cout << "refreshing library: " << this->nameLibrary << std::endl;
//set attributes
this->type = wxDIR_DIRS;
while (cont)
{
std::string stdfileName = crea::wx2std(fileName);
- std::string folderName = stdfileName;
//check if they already exist
bool found = false;
- for (int i = 0;!found && i < this->folders.size(); i++)
+ for (int i = 0; !found && i < this->folders.size(); i++)
{
- if (this->folders[i]->GetName() == folderName)
+ if (this->folders[i]->GetName() == stdfileName)
{
found = true;
int pos = std::find(this->children.begin(), this->children.end(), this->folders[i]) - this->children.begin();
return false;
}
}
- //if is an unknown file, create file
+ //if is an unknown file, check if exist in children
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->folders.begin(), this->folders.end(), CompareNodeItem);
return true;
}