<reponame>KacperKotlewski/file_structure_to_markdown<filename>files2md/structure_objects/structurable_directory/build_tree.py
from .directoryObj import DirectoryObj

def buildFilesTree(dir_obj:DirectoryObj, dirprefix):
    result=""
    pref = ((dirprefix[:-1] + "-") if (dirprefix != "") else "")
    result += (pref + dir_obj.getName() +"\n")
    dirprefix += "| "
    for d in dir_obj.files:
        if d.getType() == DirectoryObj:
            result += d.getTree(dirprefix)
        else:
            result += (dirprefix + d.getName() +"\n")
    return result
from .directoryObj import DirectoryObj

def buildFilesTree(dir_obj:DirectoryObj, dirprefix):
    result=""
    pref = ((dirprefix[:-1] + "-") if (dirprefix != "") else "")
    result += (pref + dir_obj.getName() +"\n")
    dirprefix += "| "
    for d in dir_obj.files:
        if d.getType() == DirectoryObj:
            result += d.getTree(dirprefix)
        else:
            result += (dirprefix + d.getName() +"\n")
    return result