MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / Add

Method Add

src/gui/filesystemmodel.cc:254–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252 }
253
254 void Add(std::shared_ptr<Dirent> dirent) override
255 {
256 auto parent = Find(dirent->path.parent());
257 if (!parent)
258 return;
259
260 /* Add the actual item (the easy bit). */
261
262 auto node = std::make_shared<FilesystemNode>(dirent);
263 _byItem[node->item] = node;
264 parent->children[dirent->filename] = node;
265 ItemAdded(parent->item, node->item);
266
267 /* If this is a new directory, add the stub item to it. */
268
269 if (dirent->file_type == TYPE_DIRECTORY)
270 {
271 auto stub =
272 std::make_shared<FilesystemNode>(std::make_shared<Dirent>());
273 _byItem[stub->item] = stub;
274 node->children[""] = stub;
275 stub->stub = true;
276 stub->dirent->path = dirent->path;
277 stub->dirent->path.push_back("");
278 ItemAdded(node->item, stub->item);
279 }
280 }
281
282private:
283 std::shared_ptr<FilesystemNode> _root;

Callers 15

GetChildrenMethod · 0.80
MainWindowGenMethod · 0.80
TextViewerWindowGenMethod · 0.80
FluxViewerWindowGenMethod · 0.80
TextEditorWindowGenMethod · 0.80
FileViewerWindowGenMethod · 0.80
GetfileDialogMethod · 0.80
FileConflictDialogMethod · 0.80
FileRenameDialogMethod · 0.80
CreateDirectoryDialogMethod · 0.80
FormatDialogMethod · 0.80
IdlePanelGenMethod · 0.80

Calls 2

parentMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected