# Path: gogdb/application/datasources.py
# def get_storagedb():
#     if "storagedb" not in flask.g:
#         storage_path = flask.current_app.config["STORAGE_PATH"]
#         flask.g.storagedb = storage.Storage(storage_path)
# 
#     return flask.g.storagedb


import io
import math
import pathlib
import flask
import gogdb.core.buildloader as buildloader
from gogdb.application.datasources import get_storagedb
    elif item.type == "dir":
        cur_level[tail] = {}
    else: # link
        cur_level[tail] = item

TREE_CONTINUE = "├── "
TREE_END =      "└── "
TREE_SKIP =     "│   "
TREE_NONE =     "    "
def print_tree(dirtree, cur_indent="", **kwargs):
    for index, item in enumerate(sorted(dirtree.items())):
        name, child = item
        is_last = index == len(dirtree) - 1
        if is_last:
            this_indent = TREE_END
            lower_indent = TREE_NONE
        else:
            this_indent = TREE_CONTINUE
            lower_indent = TREE_SKIP
        if type(child) is dict:
            description = "({} Entries)".format(len(child))
        elif child.type == "file":
            description = "({})".format(format_size(child.size))
        elif child.type == "link":
            description = "-> {}".format(child.target)
        print(cur_indent + this_indent + name, description, **kwargs)
        if type(child) is dict:
            print_tree(child, cur_indent + lower_indent, **kwargs)

def manifest(manifest_id):

# Path: gogdb/application/datasources.py
# def get_storagedb():
#     if "storagedb" not in flask.g:
#         storage_path = flask.current_app.config["STORAGE_PATH"]
#         flask.g.storagedb = storage.Storage(storage_path)
# 
#     return flask.g.storagedb


# Path: gogdb/views/manifest.py
import io
import math
import pathlib
import flask
import gogdb.core.buildloader as buildloader
from gogdb.application.datasources import get_storagedb

    elif item.type == "dir":
        cur_level[tail] = {}
    else: # link
        cur_level[tail] = item

TREE_CONTINUE = "├── "
TREE_END =      "└── "
TREE_SKIP =     "│   "
TREE_NONE =     "    "
def print_tree(dirtree, cur_indent="", **kwargs):
    for index, item in enumerate(sorted(dirtree.items())):
        name, child = item
        is_last = index == len(dirtree) - 1
        if is_last:
            this_indent = TREE_END
            lower_indent = TREE_NONE
        else:
            this_indent = TREE_CONTINUE
            lower_indent = TREE_SKIP
        if type(child) is dict:
            description = "({} Entries)".format(len(child))
        elif child.type == "file":
            description = "({})".format(format_size(child.size))
        elif child.type == "link":
            description = "-> {}".format(child.target)
        print(cur_indent + this_indent + name, description, **kwargs)
        if type(child) is dict:
            print_tree(child, cur_indent + lower_indent, **kwargs)

def manifest(manifest_id):

    storagedb = get_storagedb()