MCPcopy Create free account
hub / github.com/MrKepzie/Natron / mkPathInternal

Method mkPathInternal

Engine/FileSystemModel.cpp:1047–1081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1045}
1046
1047boost::shared_ptr<FileSystemItem>
1048FileSystemModel::mkPathInternal(const boost::shared_ptr<FileSystemItem>& item,
1049 const QStringList& path,
1050 int index)
1051{
1052 assert(index < path.size() && index >= 0);
1053
1054 boost::shared_ptr<FileSystemItem> child;
1055 for (int i = 0; i < item->childCount(); ++i) {
1056 boost::shared_ptr<FileSystemItem> c = item->childAt(i);
1057 if ( c && (c->fileName() == path[index]) ) {
1058 child = c;
1059 break;
1060 }
1061 }
1062
1063 if (!child) {
1064 QFileInfo info( generateChildAbsoluteName(item.get(), path[index]) );
1065 ///The child doesn't exist already, create it without populating it
1066 child = FileSystemItem::create(shared_from_this(), true, //isDir
1067 path[index], //name
1068 path[index], //name
1069 boost::shared_ptr<SequenceParsing::SequenceFromFiles>(),
1070 info.lastModified(),
1071 0, //0 for directories
1072 item);
1073 _imp->registerItem(child);
1074 item->addChild(child);
1075 }
1076 if (index == path.size() - 1) {
1077 return child;
1078 } else {
1079 return mkPathInternal(child, path, index + 1);
1080 }
1081}
1082
1083boost::shared_ptr<FileSystemItem>
1084FileSystemModel::mkPath(const QString& path)

Callers

nothing calls this directly

Calls 7

childCountMethod · 0.80
childAtMethod · 0.80
registerItemMethod · 0.80
addChildMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected