def insert_dirname(self, dirname):
        if not self.exists(nodify(dirname)):
            nodename = nodify(dirname)
            parent, child = os.path.split(dirname)
            if self.root:
                # We're displaying a subtree.
                if nodename == nodify(self.root):
                    # If this is the CWD, display at the root of the tree.
                    path = nodify(child)
                    base = ''
                else:
                    self.insert_dirname(parent)
                    base = nodify(parent)
                    path = nodify(child)
            else:
                # Check for the "root" on both unix and Windows
                if child == '':
                    path = nodify(parent)
                    base = ''
                else:
                    self.insert_dirname(parent)
                    base = nodify(parent)
                    path = nodify(child)

            # Establish the index at which to insert this child.
            # Do this by getting a list of children, sorting the list by name
            # and then finding how many would sort less than the label for
            # this node.
            files = sorted(self.get_children(base), reverse=False)
            index = len([item for item in files if item < nodify(dirname)])

            # Now insert a new node at the index that was found.
            self.insert(
                base, index, nodename,
                text=path,
                open=True,
                tags=['directory']
            )
Ensure that a specific directory exists in the breakpoint tree
dataset/ETHPy150Open pybee/duvet/duvet/widgets.py/FileView.insert_dirname