bool Project::Item::addFile (const File& file, int insertIndex, const bool shouldCompile) { if (file == File::nonexistent || file.isHidden() || file.getFileName().startsWithChar ('.')) return false; if (file.isDirectory()) { Item group (addNewSubGroup (file.getFileName(), insertIndex)); for (DirectoryIterator iter (file, false, "*", File::findFilesAndDirectories); iter.next();) if (! project.getMainGroup().findItemForFile (iter.getFile()).isValid()) group.addFile (iter.getFile(), -1, shouldCompile); group.sortAlphabetically (false); } else if (file.existsAsFile()) { if (! project.getMainGroup().findItemForFile (file).isValid()) addFileUnchecked (file, insertIndex, shouldCompile); } else { jassertfalse; } return true; }
Project::Item Project::Item::getOrCreateSubGroup (const String& name) { for (int i = state.getNumChildren(); --i >= 0;) { const ValueTree child (state.getChild (i)); if (child.getProperty (Ids::name) == name && child.hasType (Tags::group)) return Item (project, child); } return addNewSubGroup (name, -1); }